p)return;u>o&&(o=u,n=t)}var v=parseInt(n),x=parseInt(v+1p*p)return;a.m_pointCount=1,a.m_type=w.e_faceA,a.m_localPlaneNormal.x=l-y.x,a.m_localPlaneNormal.y=m-y.y,a.m_localPlaneNormal.Normalize(),a.m_localPoint.SetV(y),a.m_points[0].m_localPoint.SetV(d.m_p),a.m_points[0].m_id.key=0}else if(B<=0){if((l-z.x)*(l-z.x)+(m-z.y)*(m-z.y)>p*p)return;a.m_pointCount=1,a.m_type=w.e_faceA,a.m_localPlaneNormal.x=l-z.x,a.m_localPlaneNormal.y=m-z.y,a.m_localPlaneNormal.Normalize(),a.m_localPoint.SetV(z),a.m_points[0].m_localPoint.SetV(d.m_p),a.m_points[0].m_id.key=0}else{var C=.5*(y.x+z.x),D=.5*(y.y+z.y);if((o=(l-C)*s[v].x+(m-D)*s[v].y)>p)return;a.m_pointCount=1,a.m_type=w.e_faceA,a.m_localPlaneNormal.x=s[v].x,a.m_localPlaneNormal.y=s[v].y,a.m_localPlaneNormal.Normalize(),a.m_localPoint.Set(C,D),a.m_points[0].m_localPoint.SetV(d.m_p),a.m_points[0].m_id.key=0}},l.TestOverlap=function(a,b){var c=b.lowerBound,d=a.upperBound,e=c.x-d.x,f=c.y-d.y;c=a.lowerBound,d=b.upperBound;var g=c.x-d.x,h=c.y-d.y;return!(e>0||f>0)&&!(g>0||h>0)},Box2D.postDefs.push(function(){Box2D.Collision.b2Collision.s_incidentEdge=l.MakeClipPointVector(),Box2D.Collision.b2Collision.s_clipPoints1=l.MakeClipPointVector(),Box2D.Collision.b2Collision.s_clipPoints2=l.MakeClipPointVector(),Box2D.Collision.b2Collision.s_edgeAO=new Vector_a2j_Number(1),Box2D.Collision.b2Collision.s_edgeBO=new Vector_a2j_Number(1),Box2D.Collision.b2Collision.s_localTangent=new h,Box2D.Collision.b2Collision.s_localNormal=new h,Box2D.Collision.b2Collision.s_planePoint=new h,Box2D.Collision.b2Collision.s_normal=new h,Box2D.Collision.b2Collision.s_tangent=new h,Box2D.Collision.b2Collision.s_tangent2=new h,Box2D.Collision.b2Collision.s_v11=new h,Box2D.Collision.b2Collision.s_v12=new h,Box2D.Collision.b2Collision.b2CollidePolyTempVec=new h,Box2D.Collision.b2Collision.b2_nullFeature=255}),m.b2ContactID=function(){this.features=new K},m.prototype.b2ContactID=function(){this.features._m_id=this},m.prototype.Set=function(a){this.key=a._key},m.prototype.Copy=function(){var a=new m;return a.key=this.key,a},Object.defineProperty(m.prototype,"key",{enumerable:!1,configurable:!0,get:function(){return this._key}}),Object.defineProperty(m.prototype,"key",{enumerable:!1,configurable:!0,set:function(a){void 0===a&&(a=0),this._key=a,this.features._referenceEdge=255&this._key,this.features._incidentEdge=(65280&this._key)>>8&255,this.features._incidentVertex=(16711680&this._key)>>16&255,this.features._flip=(4278190080&this._key)>>24&255}}),n.b2ContactPoint=function(){this.position=new h,this.velocity=new h,this.normal=new h,this.id=new m},o.b2Distance=function(){},o.Distance=function(a,b,c){++o.b2_gjkCalls;var f=c.proxyA,g=c.proxyB,i=c.transformA,j=c.transformB,k=o.s_simplex;k.ReadCache(b,f,i,g,j);for(var l,m=k.m_vertices,n=20,p=o.s_saveA,q=o.s_saveB,r=0,s=k.GetClosestPoint(),t=s.LengthSquared(),u=t,v=0,w=0;wA+B&&a.distance>Number.MIN_VALUE){a.distance-=A+B;var C=e.SubtractVV(a.pointB,a.pointA);C.Normalize(),a.pointA.x+=A*C.x,a.pointA.y+=A*C.y,a.pointB.x-=B*C.x,a.pointB.y-=B*C.y}else l=new h,l.x=.5*(a.pointA.x+a.pointB.x),l.y=.5*(a.pointA.y+a.pointB.y),a.pointA.x=a.pointB.x=l.x,a.pointA.y=a.pointB.y=l.y,a.distance=0}},Box2D.postDefs.push(function(){Box2D.Collision.b2Distance.s_simplex=new D,Box2D.Collision.b2Distance.s_saveA=new Vector_a2j_Number(3),Box2D.Collision.b2Distance.s_saveB=new Vector_a2j_Number(3)}),p.b2DistanceInput=function(){},q.b2DistanceOutput=function(){this.pointA=new h,this.pointB=new h},r.b2DistanceProxy=function(){},r.prototype.Set=function(e){switch(e.GetType()){case c.e_circleShape:var f=e instanceof a?e:null;this.m_vertices=new Vector(1,!0),this.m_vertices[0]=f.m_p,this.m_count=1,this.m_radius=f.m_radius;break;case c.e_polygonShape:var g=e instanceof b?e:null;this.m_vertices=g.m_vertices,this.m_count=g.m_vertexCount,this.m_radius=g.m_radius;break;default:d.b2Assert(!1)}},r.prototype.GetSupport=function(a){for(var b=0,c=this.m_vertices[0].x*a.x+this.m_vertices[0].y*a.y,d=1;d c&&(b=d,c=e)}return b},r.prototype.GetSupportVertex=function(a){for(var b=0,c=this.m_vertices[0].x*a.x+this.m_vertices[0].y*a.y,d=1;d c&&(b=d,c=e)}return this.m_vertices[b]},r.prototype.GetVertexCount=function(){return this.m_count},r.prototype.GetVertex=function(a){return void 0===a&&(a=0),d.b2Assert(0<=a&&a 0?c.x:-c.x),f=d.b2_aabbExtension+d.b2_aabbMultiplier*(c.y>0?c.y:-c.y);return a.aabb.lowerBound.x=b.lowerBound.x-e,a.aabb.lowerBound.y=b.lowerBound.y-f,a.aabb.upperBound.x=b.upperBound.x+e,a.aabb.upperBound.y=b.upperBound.y+f,this.InsertLeaf(a),!0},s.prototype.Rebalance=function(a){if(void 0===a&&(a=0),null!=this.m_root)for(var b=0;b>d&1?c.child2:c.child1,d=d+1&31;++this.m_path,this.RemoveLeaf(c),this.InsertLeaf(c)}},s.prototype.GetFatAABB=function(a){return a.aabb},s.prototype.GetUserData=function(a){return a.userData},s.prototype.Query=function(a,b){if(null!=this.m_root){var c=new Vector,d=0;for(c[d++]=this.m_root;d>0;){var e=c[--d];if(e.aabb.TestOverlap(b))if(e.IsLeaf()){var f=a(e);if(!f)return}else c[d++]=e.child1,c[d++]=e.child2}}},s.prototype.RayCast=function(a,b){if(null!=this.m_root){var c=b.p1,d=b.p2,f=e.SubtractVV(c,d);f.Normalize();var g=e.CrossFV(1,f),h=e.AbsV(g),j=b.maxFraction,k=new i,l=0,m=0;l=c.x+j*(d.x-c.x),m=c.y+j*(d.y-c.y),k.lowerBound.x=Math.min(c.x,l),k.lowerBound.y=Math.min(c.y,m),k.upperBound.x=Math.max(c.x,l),k.upperBound.y=Math.max(c.y,m);var n=new Vector,o=0;for(n[o++]=this.m_root;o>0;){var p=n[--o];if(0!=p.aabb.TestOverlap(k)){var q=p.aabb.GetCenter(),r=p.aabb.GetExtents();if(!(Math.abs(g.x*(c.x-q.x)+g.y*(c.y-q.y))-h.x*r.x-h.y*r.y>0))if(p.IsLeaf()){var s=new z;if(s.p1=b.p1,s.p2=b.p2,s.maxFraction=b.maxFraction,0==(j=a(s,p)))return;j>0&&(l=c.x+j*(d.x-c.x),m=c.y+j*(d.y-c.y),k.lowerBound.x=Math.min(c.x,l),k.lowerBound.y=Math.min(c.y,m),k.upperBound.x=Math.max(c.x,l),k.upperBound.y=Math.max(c.y,m))}else n[o++]=p.child1,n[o++]=p.child2}}}},s.prototype.AllocateNode=function(){if(this.m_freeList){var a=this.m_freeList;return this.m_freeList=a.parent,a.parent=null,a.child1=null,a.child2=null,a}return new u},s.prototype.FreeNode=function(a){a.parent=this.m_freeList,this.m_freeList=a},s.prototype.InsertLeaf=function(a){if(++this.m_insertionCount,null==this.m_root)return this.m_root=a,void(this.m_root.parent=null);var b=a.aabb.GetCenter(),c=this.m_root;if(0==c.IsLeaf())do{var d=c.child1,e=c.child2,f=Math.abs((d.aabb.lowerBound.x+d.aabb.upperBound.x)/2-b.x)+Math.abs((d.aabb.lowerBound.y+d.aabb.upperBound.y)/2-b.y),g=Math.abs((e.aabb.lowerBound.x+e.aabb.upperBound.x)/2-b.x)+Math.abs((e.aabb.lowerBound.y+e.aabb.upperBound.y)/2-b.y);c=f =d?a:d,++c.m_pairCount,!0}var c=this;c.m_pairCount=0;var d,e=0;for(e=0;e l){var n=e.x-this.p1.x,o=e.y-this.p1.y,p=n*j+o*k;if(0<=p&&p<=d*m){var q=-f*o+g*n;if(-l*m<=q&&q<=m*(1+l)){p/=m;var r=Math.sqrt(j*j+k*k);return j/=r,k/=r,a[0]=p,b.Set(j,k),!0}}}return!1},B.prototype.Extend=function(a){this.ExtendForward(a),this.ExtendBackward(a)},B.prototype.ExtendForward=function(a){var b=this.p2.x-this.p1.x,c=this.p2.y-this.p1.y,d=Math.min(b>0?(a.upperBound.x-this.p1.x)/b:b<0?(a.lowerBound.x-this.p1.x)/b:Number.POSITIVE_INFINITY,c>0?(a.upperBound.y-this.p1.y)/c:c<0?(a.lowerBound.y-this.p1.y)/c:Number.POSITIVE_INFINITY);this.p2.x=this.p1.x+b*d,this.p2.y=this.p1.y+c*d},B.prototype.ExtendBackward=function(a){var b=-this.p2.x+this.p1.x,c=-this.p2.y+this.p1.y,d=Math.min(b>0?(a.upperBound.x-this.p2.x)/b:b<0?(a.lowerBound.x-this.p2.x)/b:Number.POSITIVE_INFINITY,c>0?(a.upperBound.y-this.p2.y)/c:c<0?(a.lowerBound.y-this.p2.y)/c:Number.POSITIVE_INFINITY);this.p1.x=this.p2.x+b*d,this.p1.y=this.p2.y+c*d},C.b2SeparationFunction=function(){this.m_localPoint=new h,this.m_axis=new h},C.prototype.Initialize=function(a,b,c,f,g){this.m_proxyA=b,this.m_proxyB=f;var i=parseInt(a.count);d.b2Assert(01){var m=a.metric,n=this.GetMetric();(n<.5*m||2*m 0?e.CrossFV(1,a):e.CrossVF(a,1);default:return d.b2Assert(!1),new h}},D.prototype.GetClosestPoint=function(){switch(this.m_count){case 0:return d.b2Assert(!1),new h;case 1:return this.m_v1.w;case 2:return new h(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);default:return d.b2Assert(!1),new h}},D.prototype.GetWitnessPoints=function(a,b){switch(this.m_count){case 0:d.b2Assert(!1);break;case 1:a.SetV(this.m_v1.wA),b.SetV(this.m_v1.wB);break;case 2:a.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,a.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,b.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,b.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:b.x=a.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x,b.y=a.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y;break;default:d.b2Assert(!1)}},D.prototype.GetMetric=function(){switch(this.m_count){case 0:return d.b2Assert(!1),0;case 1:return 0;case 2:return e.SubtractVV(this.m_v1.w,this.m_v2.w).Length();case 3:return e.CrossVV(e.SubtractVV(this.m_v2.w,this.m_v1.w),e.SubtractVV(this.m_v3.w,this.m_v1.w));default:return d.b2Assert(!1),0}},D.prototype.Solve2=function(){var a=this.m_v1.w,b=this.m_v2.w,c=e.SubtractVV(b,a),d=-(a.x*c.x+a.y*c.y);if(d<=0)return this.m_v1.a=1,void(this.m_count=1);var f=b.x*c.x+b.y*c.y;if(f<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Set(this.m_v2);var g=1/(f+d);this.m_v1.a=f*g,this.m_v2.a=d*g,this.m_count=2},D.prototype.Solve3=function(){var a=this.m_v1.w,b=this.m_v2.w,c=this.m_v3.w,d=e.SubtractVV(b,a),f=e.Dot(a,d),g=e.Dot(b,d),h=g,i=-f,j=e.SubtractVV(c,a),k=e.Dot(a,j),l=e.Dot(c,j),m=l,n=-k,o=e.SubtractVV(c,b),p=e.Dot(b,o),q=e.Dot(c,o),r=q,s=-p,t=e.CrossVV(d,j),u=t*e.CrossVV(b,c),v=t*e.CrossVV(c,a),w=t*e.CrossVV(a,b);if(i<=0&&n<=0)return this.m_v1.a=1,void(this.m_count=1);if(h>0&&i>0&&w<=0){var x=1/(h+i);return this.m_v1.a=h*x,this.m_v2.a=i*x,void(this.m_count=2)}if(m>0&&n>0&&v<=0){var y=1/(m+n);return this.m_v1.a=m*y,this.m_v3.a=n*y,this.m_count=2,void this.m_v2.Set(this.m_v3)}if(h<=0&&s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Set(this.m_v2);if(m<=0&&r<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Set(this.m_v3);if(r>0&&s>0&&u<=0){var z=1/(r+s);return this.m_v2.a=r*z,this.m_v3.a=s*z,this.m_count=2,void this.m_v1.Set(this.m_v3)}var A=1/(u+v+w);this.m_v1.a=u*A,this.m_v2.a=v*A,this.m_v3.a=w*A,this.m_count=3},E.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3),this.indexB=new Vector_a2j_Number(3)},F.b2SimplexVertex=function(){},F.prototype.Set=function(a){this.wA.SetV(a.wA),this.wB.SetV(a.wB),this.w.SetV(a.w),this.a=a.a,this.indexA=a.indexA,this.indexB=a.indexB},G.b2TimeOfImpact=function(){},G.TimeOfImpact=function(a){++G.b2_toiCalls;var b=a.proxyA,c=a.proxyB,f=a.sweepA,g=a.sweepB;d.b2Assert(f.t0==g.t0),d.b2Assert(1-f.t0>Number.MIN_VALUE);var h=b.m_radius+c.m_radius,i=a.tolerance,j=0,k=0,l=0;for(G.s_cache.count=0,G.s_distanceInput.useRadii=!1;;){if(f.GetTransform(G.s_xfA,j),g.GetTransform(G.s_xfB,j),G.s_distanceInput.proxyA=b,G.s_distanceInput.proxyB=c,G.s_distanceInput.transformA=G.s_xfA,G.s_distanceInput.transformB=G.s_xfB,o.Distance(G.s_distanceOutput,G.s_cache,G.s_distanceInput),G.s_distanceOutput.distance<=0){j=1;break}G.s_fcn.Initialize(G.s_cache,b,G.s_xfA,c,G.s_xfB);var m=G.s_fcn.Evaluate(G.s_xfA,G.s_xfB);if(m<=0){j=1;break}if(0==k&&(l=m>h?e.Max(h-i,.75*h):e.Max(m-i,.02*h)),m-l<.5*i){if(0==k){j=1;break}break}var n=j,p=j,q=1,r=m;f.GetTransform(G.s_xfA,q),g.GetTransform(G.s_xfB,q);var s=G.s_fcn.Evaluate(G.s_xfA,G.s_xfB);if(s>=l){j=1;break}for(var t=0;;){var u=0;u=1&t?p+(l-r)*(q-p)/(s-r):.5*(p+q),f.GetTransform(G.s_xfA,u),g.GetTransform(G.s_xfB,u);var v=G.s_fcn.Evaluate(G.s_xfA,G.s_xfB);if(e.Abs(v-l)<.025*i){n=u;break}if(v>l?(p=u,r=v):(q=u,s=v),++t,++G.b2_toiRootIters,50==t)break}if(G.b2_toiMaxRootIters=e.Max(G.b2_toiMaxRootIters,t),n<(1+100*Number.MIN_VALUE)*j)break;if(j=n,k++,++G.b2_toiIters,1e3==k)break}return G.b2_toiMaxIters=e.Max(G.b2_toiMaxIters,k),j},Box2D.postDefs.push(function(){Box2D.Collision.b2TimeOfImpact.b2_toiCalls=0,Box2D.Collision.b2TimeOfImpact.b2_toiIters=0,Box2D.Collision.b2TimeOfImpact.b2_toiMaxIters=0,Box2D.Collision.b2TimeOfImpact.b2_toiRootIters=0,Box2D.Collision.b2TimeOfImpact.b2_toiMaxRootIters=0,Box2D.Collision.b2TimeOfImpact.s_cache=new E,Box2D.Collision.b2TimeOfImpact.s_distanceInput=new p,Box2D.Collision.b2TimeOfImpact.s_xfA=new g,Box2D.Collision.b2TimeOfImpact.s_xfB=new g,Box2D.Collision.b2TimeOfImpact.s_fcn=new C,Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new q}),H.b2TOIInput=function(){this.proxyA=new r,this.proxyB=new r,this.sweepA=new f,this.sweepB=new f},I.b2WorldManifold=function(){this.m_normal=new h},I.prototype.b2WorldManifold=function(){this.m_points=new Vector(d.b2_maxManifoldPoints);for(var a=0;a Number.MIN_VALUE*Number.MIN_VALUE){var v=Math.sqrt(u);this.m_normal.x=s/v,this.m_normal.y=t/v}else this.m_normal.x=1,this.m_normal.y=0;var x=o+c*this.m_normal.x,y=p+c*this.m_normal.y,z=q-e*this.m_normal.x,A=r-e*this.m_normal.y;this.m_points[0].x=.5*(x+z),this.m_points[0].y=.5*(y+A);break;case w.e_faceA:for(g=b.R,f=a.m_localPlaneNormal,i=g.col1.x*f.x+g.col2.x*f.y,j=g.col1.y*f.x+g.col2.y*f.y,g=b.R,f=a.m_localPoint,k=b.position.x+g.col1.x*f.x+g.col2.x*f.y,l=b.position.y+g.col1.y*f.x+g.col2.y*f.y,this.m_normal.x=i,this.m_normal.y=j,h=0;h this.m_radius)return d.SetV(e),Math.PI*this.m_radius*this.m_radius;var g=this.m_radius*this.m_radius,h=f*f,j=g*(Math.asin(f/this.m_radius)+Math.PI/2)+f*Math.sqrt(g-h),k=-2/3*Math.pow(g-h,1.5)/j;return d.x=e.x+a.x*k,d.y=e.y+a.y*k,j},b.prototype.GetLocalPosition=function(){return this.m_p},b.prototype.SetLocalPosition=function(a){this.m_p.SetV(a)},b.prototype.GetRadius=function(){return this.m_radius},b.prototype.SetRadius=function(a){void 0===a&&(a=0),this.m_radius=a},b.prototype.b2CircleShape=function(a){void 0===a&&(a=0),this.__super.b2Shape.call(this),this.m_type=g.e_circleShape,this.m_radius=a},c.b2EdgeChainDef=function(){},c.prototype.b2EdgeChainDef=function(){this.vertexCount=0,this.isALoop=!0,this.vertices=[]},Box2D.inherit(d,Box2D.Collision.Shapes.b2Shape),d.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype,d.b2EdgeShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments),this.s_supportVec=new k,this.m_v1=new k,this.m_v2=new k,this.m_coreV1=new k,this.m_coreV2=new k,this.m_normal=new k,this.m_direction=new k,this.m_cornerDir1=new k,this.m_cornerDir2=new k},d.prototype.TestPoint=function(a,b){return!1},d.prototype.RayCast=function(a,b,c){var d,e=b.p2.x-b.p1.x,f=b.p2.y-b.p1.y;d=c.R;var g=c.position.x+(d.col1.x*this.m_v1.x+d.col2.x*this.m_v1.y),h=c.position.y+(d.col1.y*this.m_v1.x+d.col2.y*this.m_v1.y),i=c.position.y+(d.col1.y*this.m_v2.x+d.col2.y*this.m_v2.y)-h,j=-(c.position.x+(d.col1.x*this.m_v2.x+d.col2.x*this.m_v2.y)-g),k=100*Number.MIN_VALUE,l=-(e*i+f*j);if(l>k){var m=b.p1.x-g,n=b.p1.y-h,o=m*i+n*j;if(0<=o&&o<=b.maxFraction*l){var p=-e*n+f*m;if(-k*l<=p&&p<=l*(1+k)){o/=l,a.fraction=o;var q=Math.sqrt(i*i+j*j);return a.normal.x=i/q,a.normal.y=j/q,!0}}}return!1},d.prototype.ComputeAABB=function(a,b){var c=b.R,d=b.position.x+(c.col1.x*this.m_v1.x+c.col2.x*this.m_v1.y),e=b.position.y+(c.col1.y*this.m_v1.x+c.col2.y*this.m_v1.y),f=b.position.x+(c.col1.x*this.m_v2.x+c.col2.x*this.m_v2.y),g=b.position.y+(c.col1.y*this.m_v2.x+c.col2.y*this.m_v2.y);d 0){if(j>0)return 0;f.x=-j/(h-j)*f.x+h/(h-j)*g.x,f.y=-j/(h-j)*f.y+h/(h-j)*g.y}else j>0&&(g.x=-j/(h-j)*f.x+h/(h-j)*g.x,g.y=-j/(h-j)*f.y+h/(h-j)*g.y);return d.x=(e.x+f.x+g.x)/3,d.y=(e.y+f.y+g.y)/3,.5*((f.x-e.x)*(g.y-e.y)-(f.y-e.y)*(g.x-e.x))},d.prototype.GetLength=function(){return this.m_length},d.prototype.GetVertex1=function(){return this.m_v1},d.prototype.GetVertex2=function(){return this.m_v2},d.prototype.GetCoreVertex1=function(){return this.m_coreV1},d.prototype.GetCoreVertex2=function(){return this.m_coreV2},d.prototype.GetNormalVector=function(){return this.m_normal},d.prototype.GetDirectionVector=function(){return this.m_direction},d.prototype.GetCorner1Vector=function(){return this.m_cornerDir1},d.prototype.GetCorner2Vector=function(){return this.m_cornerDir2},d.prototype.Corner1IsConvex=function(){return this.m_cornerConvex1},d.prototype.Corner2IsConvex=function(){return this.m_cornerConvex2},d.prototype.GetFirstVertex=function(a){var b=a.R;return new k(a.position.x+(b.col1.x*this.m_coreV1.x+b.col2.x*this.m_coreV1.y),a.position.y+(b.col1.y*this.m_coreV1.x+b.col2.y*this.m_coreV1.y))},d.prototype.GetNextEdge=function(){return this.m_nextEdge},d.prototype.GetPrevEdge=function(){return this.m_prevEdge},d.prototype.Support=function(a,b,c){void 0===b&&(b=0),void 0===c&&(c=0);var d=a.R,e=a.position.x+(d.col1.x*this.m_coreV1.x+d.col2.x*this.m_coreV1.y),f=a.position.y+(d.col1.y*this.m_coreV1.x+d.col2.y*this.m_coreV1.y),g=a.position.x+(d.col1.x*this.m_coreV2.x+d.col2.x*this.m_coreV2.y),h=a.position.y+(d.col1.y*this.m_coreV2.x+d.col2.y*this.m_coreV2.y);return e*b+f*c>g*b+h*c?(this.s_supportVec.x=e,this.s_supportVec.y=f):(this.s_supportVec.x=g,this.s_supportVec.y=h),this.s_supportVec},d.prototype.b2EdgeShape=function(b,c){this.__super.b2Shape.call(this),this.m_type=g.e_edgeShape,this.m_prevEdge=null,this.m_nextEdge=null,this.m_v1=b,this.m_v2=c,this.m_direction.Set(this.m_v2.x-this.m_v1.x,this.m_v2.y-this.m_v1.y),this.m_length=this.m_direction.Normalize(),this.m_normal.Set(this.m_direction.y,-this.m_direction.x),this.m_coreV1.Set(-a.b2_toiSlop*(this.m_normal.x-this.m_direction.x)+this.m_v1.x,-a.b2_toiSlop*(this.m_normal.y-this.m_direction.y)+this.m_v1.y),this.m_coreV2.Set(-a.b2_toiSlop*(this.m_normal.x+this.m_direction.x)+this.m_v2.x,-a.b2_toiSlop*(this.m_normal.y+this.m_direction.y)+this.m_v2.y),this.m_cornerDir1=this.m_normal,this.m_cornerDir2.Set(-this.m_normal.x,-this.m_normal.y)},d.prototype.SetPrevEdge=function(a,b,c,d){this.m_prevEdge=a,this.m_coreV1=b,this.m_cornerDir1=c,this.m_cornerConvex1=d},d.prototype.SetNextEdge=function(a,b,c,d){this.m_nextEdge=a,this.m_coreV2=b,this.m_cornerDir2=c,this.m_cornerConvex2=d},e.b2MassData=function(){this.mass=0,this.center=new k(0,0),this.I=0},Box2D.inherit(f,Box2D.Collision.Shapes.b2Shape),f.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype,f.b2PolygonShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments)},f.prototype.Copy=function(){var a=new f;return a.Set(this),a},f.prototype.Set=function(a){if(this.__super.Set.call(this,a),Box2D.is(a,f)){var b=a instanceof f?a:null;this.m_centroid.SetV(b.m_centroid),this.m_vertexCount=b.m_vertexCount,this.Reserve(this.m_vertexCount);for(var c=0;c Number.MIN_VALUE),this.m_normals[d].SetV(i.CrossVF(h,1)),this.m_normals[d].Normalize()}this.m_centroid=f.ComputeCentroid(this.m_vertices,this.m_vertexCount)},f.AsVector=function(a,b){void 0===b&&(b=0);var c=new f;return c.SetAsVector(a,b),c},f.prototype.SetAsBox=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0),this.m_vertexCount=4,this.Reserve(4),this.m_vertices[0].Set(-a,-b),this.m_vertices[1].Set(a,-b),this.m_vertices[2].Set(a,b),this.m_vertices[3].Set(-a,b),this.m_normals[0].Set(0,-1),this.m_normals[1].Set(1,0),this.m_normals[2].Set(0,1),this.m_normals[3].Set(-1,0),this.m_centroid.SetZero()},f.AsBox=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0);var c=new f;return c.SetAsBox(a,b),c},f.prototype.SetAsOrientedBox=function(a,b,c,d){void 0===a&&(a=0),void 0===b&&(b=0),void 0===c&&(c=null),void 0===d&&(d=0),this.m_vertexCount=4,this.Reserve(4),this.m_vertices[0].Set(-a,-b),this.m_vertices[1].Set(a,-b),this.m_vertices[2].Set(a,b),this.m_vertices[3].Set(-a,b),this.m_normals[0].Set(0,-1),this.m_normals[1].Set(1,0),this.m_normals[2].Set(0,1),this.m_normals[3].Set(-1,0),this.m_centroid=c;var e=new j;e.position=c,e.R.Set(d);for(var f=0;f 0)return!1}return!0},f.prototype.RayCast=function(a,b,c){var d,e,f=0,g=b.maxFraction,h=0,i=0;h=b.p1.x-c.position.x,i=b.p1.y-c.position.y,d=c.R;var j=h*d.col1.x+i*d.col1.y,k=h*d.col2.x+i*d.col2.y;h=b.p2.x-c.position.x,i=b.p2.y-c.position.y,d=c.R;for(var l=h*d.col1.x+i*d.col1.y,m=h*d.col2.x+i*d.col2.y,n=l-j,o=m-k,p=parseInt(-1),q=0;q 0&&r =0&&(a.fraction=f,d=c.R,e=this.m_normals[p],a.normal.x=d.col1.x*e.x+d.col2.x*e.y,a.normal.y=d.col1.y*e.x+d.col2.y*e.y,!0)},f.prototype.ComputeAABB=function(a,b){for(var c=b.R,d=this.m_vertices[0],e=b.position.x+(c.col1.x*d.x+c.col2.x*d.y),f=b.position.y+(c.col1.y*d.x+c.col2.y*d.y),g=e,h=f,i=1;i j?g:j,h=h>k?h:k}a.lowerBound.x=e-this.m_radius,a.lowerBound.y=f-this.m_radius,a.upperBound.x=g+this.m_radius,a.upperBound.y=h+this.m_radius},f.prototype.ComputeMass=function(a,b){if(void 0===b&&(b=0),2==this.m_vertexCount)return a.center.x=.5*(this.m_vertices[0].x+this.m_vertices[1].x),a.center.y=.5*(this.m_vertices[0].y+this.m_vertices[1].y),a.mass=0,void(a.I=0);for(var c=0,d=0,e=0,f=0,g=0,h=0,i=1/3,j=0;j 0&&(p?n||(l=o-1,j++):n&&(m=o-1,j++)),n=p}switch(j){case 0:if(n){var q=new e;return this.ComputeMass(q,1),d.SetV(i.MulX(c,q.center)),q.mass}return 0;case 1:-1==l?l=this.m_vertexCount-1:m=this.m_vertexCount-1}var r,s=parseInt((l+1)%this.m_vertexCount),t=parseInt((m+1)%this.m_vertexCount),u=(0-h[l])/(h[s]-h[l]),v=(0-h[m])/(h[t]-h[m]),w=new k(this.m_vertices[l].x*(1-u)+this.m_vertices[s].x*u,this.m_vertices[l].y*(1-u)+this.m_vertices[s].y*u),x=new k(this.m_vertices[m].x*(1-v)+this.m_vertices[t].x*v,this.m_vertices[m].y*(1-v)+this.m_vertices[t].y*v),y=0,z=new k,A=this.m_vertices[s];for(o=s;o!=t;){o=(o+1)%this.m_vertexCount,r=o==t?x:this.m_vertices[o];var B=.5*((A.x-w.x)*(r.y-w.y)-(A.y-w.y)*(r.x-w.x));y+=B,z.x+=B*(w.x+A.x+r.x)/3,z.y+=B*(w.y+A.y+r.y)/3,A=r}return z.Multiply(1/y),d.SetV(i.MulX(c,z)),y},f.prototype.GetVertexCount=function(){return this.m_vertexCount},f.prototype.GetVertices=function(){return this.m_vertices},f.prototype.GetNormals=function(){return this.m_normals},f.prototype.GetSupport=function(a){for(var b=0,c=this.m_vertices[0].x*a.x+this.m_vertices[0].y*a.y,d=1;d c&&(b=d,c=e)}return b},f.prototype.GetSupportVertex=function(a){for(var b=0,c=this.m_vertices[0].x*a.x+this.m_vertices[0].y*a.y,d=1;d c&&(b=d,c=e)}return this.m_vertices[b]},f.prototype.Validate=function(){return!1},f.prototype.b2PolygonShape=function(){this.__super.b2Shape.call(this),this.m_type=g.e_polygonShape,this.m_centroid=new k,this.m_vertices=new Vector,this.m_normals=new Vector},f.prototype.Reserve=function(a){void 0===a&&(a=0);for(var b=parseInt(this.m_vertices.length);bo&&(o=t),u>p&&(p=u)}var v=(o-m)*(p-n);if(v<.95*f){f=v,a.R.col1.x=h,a.R.col1.y=i,a.R.col2.x=k,a.R.col2.y=l;var w=.5*(m+o),x=.5*(n+p),y=a.R;a.center.x=g.x+(y.col1.x*w+y.col2.x*x),a.center.y=g.y+(y.col1.y*w+y.col2.y*x),a.extents.x=.5*(o-m),a.extents.y=.5*(p-n)}}},Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2PolygonShape.s_mat=new h}),g.b2Shape=function(){},g.prototype.Copy=function(){return null},g.prototype.Set=function(a){this.m_radius=a.m_radius},g.prototype.GetType=function(){return this.m_type},g.prototype.TestPoint=function(a,b){return!1},g.prototype.RayCast=function(a,b,c){return!1},g.prototype.ComputeAABB=function(a,b){},g.prototype.ComputeMass=function(a,b){void 0===b&&(b=0)},g.prototype.ComputeSubmergedArea=function(a,b,c,d){return void 0===b&&(b=0),0},g.TestOverlap=function(a,b,c,d){var e=new m;e.proxyA=new o,e.proxyA.Set(a),e.proxyB=new o,e.proxyB.Set(c),e.transformA=b,e.transformB=d,e.useRadii=!0;var f=new p;f.count=0;var g=new n;return l.Distance(g,f,e),g.distance<10*Number.MIN_VALUE},g.prototype.b2Shape=function(){this.m_type=g.e_unknownShape,this.m_radius=a.b2_linearSlop},Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2Shape.e_unknownShape=parseInt(-1),Box2D.Collision.Shapes.b2Shape.e_circleShape=0,Box2D.Collision.Shapes.b2Shape.e_polygonShape=1,Box2D.Collision.Shapes.b2Shape.e_edgeShape=2,Box2D.Collision.Shapes.b2Shape.e_shapeTypeCount=3,Box2D.Collision.Shapes.b2Shape.e_hitCollide=1,Box2D.Collision.Shapes.b2Shape.e_missCollide=0,Box2D.Collision.Shapes.b2Shape.e_startsInsideCollide=parseInt(-1)})}(),function(){var a=Box2D.Common.b2Color,b=(Box2D.Common.b2internal,Box2D.Common.b2Settings),c=(Box2D.Common.Math.b2Mat22,Box2D.Common.Math.b2Mat33,Box2D.Common.Math.b2Math);Box2D.Common.Math.b2Sweep,Box2D.Common.Math.b2Transform,Box2D.Common.Math.b2Vec2,Box2D.Common.Math.b2Vec3;a.b2Color=function(){this._r=0,this._g=0,this._b=0},a.prototype.b2Color=function(a,b,d){void 0===a&&(a=0),void 0===b&&(b=0),void 0===d&&(d=0),this._r=Box2D.parseUInt(255*c.Clamp(a,0,1)),this._g=Box2D.parseUInt(255*c.Clamp(b,0,1)),this._b=Box2D.parseUInt(255*c.Clamp(d,0,1))},a.prototype.Set=function(a,b,d){void 0===a&&(a=0),void 0===b&&(b=0),void 0===d&&(d=0),this._r=Box2D.parseUInt(255*c.Clamp(a,0,1)),this._g=Box2D.parseUInt(255*c.Clamp(b,0,1)),this._b=Box2D.parseUInt(255*c.Clamp(d,0,1))},Object.defineProperty(a.prototype,"r",{enumerable:!1,configurable:!0,set:function(a){void 0===a&&(a=0),this._r=Box2D.parseUInt(255*c.Clamp(a,0,1))}}),Object.defineProperty(a.prototype,"g",{enumerable:!1,configurable:!0,set:function(a){void 0===a&&(a=0),this._g=Box2D.parseUInt(255*c.Clamp(a,0,1))}}),Object.defineProperty(a.prototype,"b",{enumerable:!1,configurable:!0,set:function(a){void 0===a&&(a=0),this._b=Box2D.parseUInt(255*c.Clamp(a,0,1))}}),Object.defineProperty(a.prototype,"color",{enumerable:!1,configurable:!0,get:function(){return this._r<<16|this._g<<8|this._b}}),b.b2Settings=function(){},b.b2MixFriction=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=0),Math.sqrt(a*b)},b.b2MixRestitution=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=0),a>b?a:b},b.b2Assert=function(a){if(!a)throw"Assertion Failed"},Box2D.postDefs.push(function(){Box2D.Common.b2Settings.VERSION="2.1alpha",Box2D.Common.b2Settings.USHRT_MAX=65535,Box2D.Common.b2Settings.b2_pi=Math.PI,Box2D.Common.b2Settings.b2_maxManifoldPoints=2,Box2D.Common.b2Settings.b2_aabbExtension=.1,Box2D.Common.b2Settings.b2_aabbMultiplier=2,Box2D.Common.b2Settings.b2_polygonRadius=2*b.b2_linearSlop,Box2D.Common.b2Settings.b2_linearSlop=.005,Box2D.Common.b2Settings.b2_angularSlop=2/180*b.b2_pi,Box2D.Common.b2Settings.b2_toiSlop=8*b.b2_linearSlop,Box2D.Common.b2Settings.b2_maxTOIContactsPerIsland=32,Box2D.Common.b2Settings.b2_maxTOIJointsPerIsland=32,Box2D.Common.b2Settings.b2_velocityThreshold=1,Box2D.Common.b2Settings.b2_maxLinearCorrection=.2,Box2D.Common.b2Settings.b2_maxAngularCorrection=8/180*b.b2_pi,Box2D.Common.b2Settings.b2_maxTranslation=2,Box2D.Common.b2Settings.b2_maxTranslationSquared=b.b2_maxTranslation*b.b2_maxTranslation,Box2D.Common.b2Settings.b2_maxRotation=.5*b.b2_pi,Box2D.Common.b2Settings.b2_maxRotationSquared=b.b2_maxRotation*b.b2_maxRotation,Box2D.Common.b2Settings.b2_contactBaumgarte=.2,Box2D.Common.b2Settings.b2_timeToSleep=.5,Box2D.Common.b2Settings.b2_linearSleepTolerance=.01,Box2D.Common.b2Settings.b2_angularSleepTolerance=2/180*b.b2_pi})}(),function(){var a=(Box2D.Collision.b2AABB,Box2D.Common.b2Color,Box2D.Common.b2internal,Box2D.Common.b2Settings,Box2D.Common.Math.b2Mat22),b=Box2D.Common.Math.b2Mat33,c=Box2D.Common.Math.b2Math,d=Box2D.Common.Math.b2Sweep,e=Box2D.Common.Math.b2Transform,f=Box2D.Common.Math.b2Vec2,g=Box2D.Common.Math.b2Vec3;a.b2Mat22=function(){this.col1=new f,this.col2=new f},a.prototype.b2Mat22=function(){this.SetIdentity()},a.FromAngle=function(b){void 0===b&&(b=0);var c=new a;return c.Set(b),c},a.FromVV=function(b,c){var d=new a;return d.SetVV(b,c),d},a.prototype.Set=function(a){void 0===a&&(a=0);var b=Math.cos(a),c=Math.sin(a);this.col1.x=b,this.col2.x=-c,this.col1.y=c,this.col2.y=b},a.prototype.SetVV=function(a,b){this.col1.SetV(a),this.col2.SetV(b)},a.prototype.Copy=function(){var b=new a;return b.SetM(this),b},a.prototype.SetM=function(a){this.col1.SetV(a.col1),this.col2.SetV(a.col2)},a.prototype.AddM=function(a){this.col1.x+=a.col1.x,this.col1.y+=a.col1.y,this.col2.x+=a.col2.x,this.col2.y+=a.col2.y},a.prototype.SetIdentity=function(){this.col1.x=1,this.col2.x=0,this.col1.y=0,this.col2.y=1},a.prototype.SetZero=function(){this.col1.x=0,this.col2.x=0,this.col1.y=0,this.col2.y=0},a.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)},a.prototype.GetInverse=function(a){var b=this.col1.x,c=this.col2.x,d=this.col1.y,e=this.col2.y,f=b*e-c*d;return 0!=f&&(f=1/f),a.col1.x=f*e,a.col2.x=-f*c,a.col1.y=-f*d,a.col2.y=f*b,a},a.prototype.Solve=function(a,b,c){void 0===b&&(b=0),void 0===c&&(c=0);var d=this.col1.x,e=this.col2.x,f=this.col1.y,g=this.col2.y,h=d*g-e*f;return 0!=h&&(h=1/h),a.x=h*(g*b-e*c),a.y=h*(d*c-f*b),a},a.prototype.Abs=function(){this.col1.Abs(),this.col2.Abs()},b.b2Mat33=function(){this.col1=new g,this.col2=new g,this.col3=new g},b.prototype.b2Mat33=function(a,b,c){void 0===a&&(a=null),void 0===b&&(b=null),void 0===c&&(c=null),a||b||c?(this.col1.SetV(a),this.col2.SetV(b),this.col3.SetV(c)):(this.col1.SetZero(),this.col2.SetZero(),this.col3.SetZero())},b.prototype.SetVVV=function(a,b,c){this.col1.SetV(a),this.col2.SetV(b),this.col3.SetV(c)},b.prototype.Copy=function(){return new b(this.col1,this.col2,this.col3)},b.prototype.SetM=function(a){this.col1.SetV(a.col1),this.col2.SetV(a.col2),this.col3.SetV(a.col3)},b.prototype.AddM=function(a){this.col1.x+=a.col1.x,this.col1.y+=a.col1.y,this.col1.z+=a.col1.z,this.col2.x+=a.col2.x,this.col2.y+=a.col2.y,this.col2.z+=a.col2.z,this.col3.x+=a.col3.x,this.col3.y+=a.col3.y,this.col3.z+=a.col3.z},b.prototype.SetIdentity=function(){this.col1.x=1,this.col2.x=0,this.col3.x=0,this.col1.y=0,this.col2.y=1,this.col3.y=0,this.col1.z=0,this.col2.z=0,this.col3.z=1},b.prototype.SetZero=function(){this.col1.x=0,this.col2.x=0,this.col3.x=0,this.col1.y=0,this.col2.y=0,this.col3.y=0,this.col1.z=0,this.col2.z=0,this.col3.z=0},b.prototype.Solve22=function(a,b,c){void 0===b&&(b=0),void 0===c&&(c=0);var d=this.col1.x,e=this.col2.x,f=this.col1.y,g=this.col2.y,h=d*g-e*f;return 0!=h&&(h=1/h),a.x=h*(g*b-e*c),a.y=h*(d*c-f*b),a},b.prototype.Solve33=function(a,b,c,d){void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0);var e=this.col1.x,f=this.col1.y,g=this.col1.z,h=this.col2.x,i=this.col2.y,j=this.col2.z,k=this.col3.x,l=this.col3.y,m=this.col3.z,n=e*(i*m-j*l)+f*(j*k-h*m)+g*(h*l-i*k);return 0!=n&&(n=1/n),a.x=n*(b*(i*m-j*l)+c*(j*k-h*m)+d*(h*l-i*k)),a.y=n*(e*(c*m-d*l)+f*(d*k-b*m)+g*(b*l-c*k)),a.z=n*(e*(i*d-j*c)+f*(j*b-h*d)+g*(h*c-i*b)),a},c.b2Math=function(){},c.IsValid=function(a){return void 0===a&&(a=0),isFinite(a)},c.Dot=function(a,b){return a.x*b.x+a.y*b.y},c.CrossVV=function(a,b){return a.x*b.y-a.y*b.x},c.CrossVF=function(a,b){return void 0===b&&(b=0),new f(b*a.y,-b*a.x)},c.CrossFV=function(a,b){return void 0===a&&(a=0),new f(-a*b.y,a*b.x)},c.MulMV=function(a,b){return new f(a.col1.x*b.x+a.col2.x*b.y,a.col1.y*b.x+a.col2.y*b.y)},c.MulTMV=function(a,b){return new f(c.Dot(b,a.col1),c.Dot(b,a.col2))},c.MulX=function(a,b){var d=c.MulMV(a.R,b);return d.x+=a.position.x,d.y+=a.position.y,d},c.MulXT=function(a,b){var d=c.SubtractVV(b,a.position),e=d.x*a.R.col1.x+d.y*a.R.col1.y;return d.y=d.x*a.R.col2.x+d.y*a.R.col2.y,d.x=e,d},c.AddVV=function(a,b){return new f(a.x+b.x,a.y+b.y)},c.SubtractVV=function(a,b){return new f(a.x-b.x,a.y-b.y)},c.Distance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)},c.DistanceSquared=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d},c.MulFV=function(a,b){return void 0===a&&(a=0),new f(a*b.x,a*b.y)},c.AddMM=function(b,d){return a.FromVV(c.AddVV(b.col1,d.col1),c.AddVV(b.col2,d.col2))},c.MulMM=function(b,d){return a.FromVV(c.MulMV(b,d.col1),c.MulMV(b,d.col2))},c.MulTMM=function(b,d){var e=new f(c.Dot(b.col1,d.col1),c.Dot(b.col2,d.col1)),g=new f(c.Dot(b.col1,d.col2),c.Dot(b.col2,d.col2));return a.FromVV(e,g)},c.Abs=function(a){return void 0===a&&(a=0),a>0?a:-a},c.AbsV=function(a){return new f(c.Abs(a.x),c.Abs(a.y))},c.AbsM=function(b){return a.FromVV(c.AbsV(b.col1),c.AbsV(b.col2))},c.Min=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=0),ab?a:b},c.MaxV=function(a,b){return new f(c.Max(a.x,b.x),c.Max(a.y,b.y))},c.Clamp=function(a,b,c){return void 0===a&&(a=0),void 0===b&&(b=0),void 0===c&&(c=0),ac?c:a},c.ClampV=function(a,b,d){return c.MaxV(b,c.MinV(a,d))},c.Swap=function(a,b){var c=a[0];a[0]=b[0],b[0]=c},c.Random=function(){return 2*Math.random()-1},c.RandomRange=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0);var c=Math.random();return c=(b-a)*c+a},c.NextPowerOfTwo=function(a){return void 0===a&&(a=0),a|=a>>1&2147483647,a|=a>>2&1073741823,a|=a>>4&268435455,a|=a>>8&16777215,(a|=a>>16&65535)+1},c.IsPowerOfTwo=function(a){return void 0===a&&(a=0),a>0&&0==(a&a-1)},Box2D.postDefs.push(function(){Box2D.Common.Math.b2Math.b2Vec2_zero=new f(0,0),Box2D.Common.Math.b2Math.b2Mat22_identity=a.FromVV(new f(1,0),new f(0,1)),Box2D.Common.Math.b2Math.b2Transform_identity=new e(c.b2Vec2_zero,c.b2Mat22_identity)}),d.b2Sweep=function(){this.localCenter=new f,this.c0=new f,this.c=new f},d.prototype.Set=function(a){this.localCenter.SetV(a.localCenter),this.c0.SetV(a.c0),this.c.SetV(a.c),this.a0=a.a0,this.a=a.a,this.t0=a.t0},d.prototype.Copy=function(){var a=new d;return a.localCenter.SetV(this.localCenter),a.c0.SetV(this.c0),a.c.SetV(this.c),a.a0=this.a0,a.a=this.a,a.t0=this.t0,a},d.prototype.GetTransform=function(a,b){void 0===b&&(b=0),a.position.x=(1-b)*this.c0.x+b*this.c.x,a.position.y=(1-b)*this.c0.y+b*this.c.y;var c=(1-b)*this.a0+b*this.a;a.R.Set(c);var d=a.R;a.position.x-=d.col1.x*this.localCenter.x+d.col2.x*this.localCenter.y,a.position.y-=d.col1.y*this.localCenter.x+d.col2.y*this.localCenter.y},d.prototype.Advance=function(a){if(void 0===a&&(a=0),this.t0Number.MIN_VALUE){var b=(a-this.t0)/(1-this.t0);this.c0.x=(1-b)*this.c0.x+b*this.c.x,this.c0.y=(1-b)*this.c0.y+b*this.c.y,this.a0=(1-b)*this.a0+b*this.a,this.t0=a}},e.b2Transform=function(){this.position=new f,this.R=new a},e.prototype.b2Transform=function(a,b){void 0===a&&(a=null),void 0===b&&(b=null),a&&(this.position.SetV(a),this.R.SetM(b))},e.prototype.Initialize=function(a,b){this.position.SetV(a),this.R.SetM(b)},e.prototype.SetIdentity=function(){this.position.SetZero(),this.R.SetIdentity()},e.prototype.Set=function(a){this.position.SetV(a.position),this.R.SetM(a.R)},e.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)},f.b2Vec2=function(){},f.prototype.b2Vec2=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0),this.x=a,this.y=b},f.prototype.SetZero=function(){this.x=0,this.y=0},f.prototype.Set=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0),this.x=a,this.y=b},f.prototype.SetV=function(a){this.x=a.x,this.y=a.y},f.prototype.GetNegative=function(){return new f(-this.x,-this.y)},f.prototype.NegativeSelf=function(){this.x=-this.x,this.y=-this.y},f.Make=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=0),new f(a,b)},f.prototype.Copy=function(){return new f(this.x,this.y)},f.prototype.Add=function(a){this.x+=a.x,this.y+=a.y},f.prototype.Subtract=function(a){this.x-=a.x,this.y-=a.y},f.prototype.Multiply=function(a){void 0===a&&(a=0),this.x*=a,this.y*=a},f.prototype.MulM=function(a){var b=this.x;this.x=a.col1.x*b+a.col2.x*this.y,this.y=a.col1.y*b+a.col2.y*this.y},f.prototype.MulTM=function(a){var b=c.Dot(this,a.col1);this.y=c.Dot(this,a.col2),this.x=b},f.prototype.CrossVF=function(a){void 0===a&&(a=0);var b=this.x;this.x=a*this.y,this.y=-a*b},f.prototype.CrossFV=function(a){void 0===a&&(a=0);var b=this.x;this.x=-a*this.y,this.y=a*b},f.prototype.MinV=function(a){this.x=this.x a.x?this.x:a.x,this.y=this.y>a.y?this.y:a.y},f.prototype.Abs=function(){this.x<0&&(this.x=-this.x),this.y<0&&(this.y=-this.y)},f.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},f.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y},f.prototype.Normalize=function(){var a=Math.sqrt(this.x*this.x+this.y*this.y);if(a 0;return b.SetNextEdge(c,h,i,j),c.SetPrevEdge(b,h,i,j),e},q.prototype.CreateFixture=function(a){if(1==this.m_world.IsLocked())return null;var b=new z;if(b.Create(this,this.m_xf,a),this.m_flags&q.e_activeFlag){var c=this.m_world.m_contactManager.m_broadPhase;b.CreateProxy(c,this.m_xf)}return b.m_next=this.m_fixtureList,this.m_fixtureList=b,++this.m_fixtureCount,b.m_body=this,b.m_density>0&&this.ResetMassData(),this.m_world.m_flags|=D.e_newFixture,b},q.prototype.CreateFixture2=function(a,b){void 0===b&&(b=0);var c=new A;return c.shape=a,c.density=b,this.CreateFixture(c)},q.prototype.DestroyFixture=function(a){if(1!=this.m_world.IsLocked()){for(var b=this.m_fixtureList,c=null;null!=b;){if(b==a){c?c.m_next=a.m_next:this.m_fixtureList=a.m_next,!0;break}c=b,b=b.m_next}for(var d=this.m_contactList;d;){var e=d.contact;d=d.next;var f=e.GetFixtureA(),g=e.GetFixtureB();a!=f&&a!=g||this.m_world.m_contactManager.Destroy(e)}if(this.m_flags&q.e_activeFlag){var h=this.m_world.m_contactManager.m_broadPhase;a.DestroyProxy(h)}a.Destroy(),a.m_body=null,a.m_next=null,--this.m_fixtureCount,this.ResetMassData()}},q.prototype.SetPositionAndAngle=function(a,b){void 0===b&&(b=0);var c;if(1!=this.m_world.IsLocked()){this.m_xf.R.Set(b),this.m_xf.position.SetV(a);var d=this.m_xf.R,e=this.m_sweep.localCenter;this.m_sweep.c.x=d.col1.x*e.x+d.col2.x*e.y,this.m_sweep.c.y=d.col1.y*e.x+d.col2.y*e.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),this.m_sweep.a0=this.m_sweep.a=b;var f=this.m_world.m_contactManager.m_broadPhase;for(c=this.m_fixtureList;c;c=c.m_next)c.Synchronize(f,this.m_xf,this.m_xf);this.m_world.m_contactManager.FindNewContacts()}},q.prototype.SetTransform=function(a){this.SetPositionAndAngle(a.position,a.GetAngle())},q.prototype.GetTransform=function(){return this.m_xf},q.prototype.GetPosition=function(){return this.m_xf.position},q.prototype.SetPosition=function(a){this.SetPositionAndAngle(a,this.GetAngle())},q.prototype.GetAngle=function(){return this.m_sweep.a},q.prototype.SetAngle=function(a){void 0===a&&(a=0),this.SetPositionAndAngle(this.GetPosition(),a)},q.prototype.GetWorldCenter=function(){return this.m_sweep.c},q.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter},q.prototype.SetLinearVelocity=function(a){this.m_type!=q.b2_staticBody&&this.m_linearVelocity.SetV(a)},q.prototype.GetLinearVelocity=function(){return this.m_linearVelocity},q.prototype.SetAngularVelocity=function(a){void 0===a&&(a=0),this.m_type!=q.b2_staticBody&&(this.m_angularVelocity=a)},q.prototype.GetAngularVelocity=function(){return this.m_angularVelocity},q.prototype.GetDefinition=function(){var a=new r;return a.type=this.GetType(),a.allowSleep=(this.m_flags&q.e_allowSleepFlag)==q.e_allowSleepFlag,a.angle=this.GetAngle(),a.angularDamping=this.m_angularDamping,a.angularVelocity=this.m_angularVelocity,a.fixedRotation=(this.m_flags&q.e_fixedRotationFlag)==q.e_fixedRotationFlag,a.bullet=(this.m_flags&q.e_bulletFlag)==q.e_bulletFlag,a.awake=(this.m_flags&q.e_awakeFlag)==q.e_awakeFlag,a.linearDamping=this.m_linearDamping,a.linearVelocity.SetV(this.GetLinearVelocity()),a.position=this.GetPosition(),a.userData=this.GetUserData(),a},q.prototype.ApplyForce=function(a,b){this.m_type==q.b2_dynamicBody&&(0==this.IsAwake()&&this.SetAwake(!0),this.m_force.x+=a.x,this.m_force.y+=a.y,this.m_torque+=(b.x-this.m_sweep.c.x)*a.y-(b.y-this.m_sweep.c.y)*a.x)},q.prototype.ApplyTorque=function(a){void 0===a&&(a=0),this.m_type==q.b2_dynamicBody&&(0==this.IsAwake()&&this.SetAwake(!0),this.m_torque+=a)},q.prototype.ApplyImpulse=function(a,b){this.m_type==q.b2_dynamicBody&&(0==this.IsAwake()&&this.SetAwake(!0),this.m_linearVelocity.x+=this.m_invMass*a.x,this.m_linearVelocity.y+=this.m_invMass*a.y,this.m_angularVelocity+=this.m_invI*((b.x-this.m_sweep.c.x)*a.y-(b.y-this.m_sweep.c.y)*a.x))},q.prototype.Split=function(b){for(var c,d=this.GetLinearVelocity().Copy(),e=this.GetAngularVelocity(),f=this.GetWorldCenter(),g=this,h=this.m_world.CreateBody(this.GetDefinition()),i=g.m_fixtureList;i;)if(b(i)){var j=i.m_next;c?c.m_next=j:g.m_fixtureList=j,g.m_fixtureCount--,i.m_next=h.m_fixtureList,h.m_fixtureList=i,h.m_fixtureCount++,i.m_body=h,i=j}else c=i,i=i.m_next;g.ResetMassData(),h.ResetMassData();var k=g.GetWorldCenter(),l=h.GetWorldCenter(),m=a.AddVV(d,a.CrossFV(e,a.SubtractVV(k,f))),n=a.AddVV(d,a.CrossFV(e,a.SubtractVV(l,f)));return g.SetLinearVelocity(m),h.SetLinearVelocity(n),g.SetAngularVelocity(e),h.SetAngularVelocity(e),g.SynchronizeFixtures(),h.SynchronizeFixtures(),h},q.prototype.Merge=function(a){var b;for(b=a.m_fixtureList;b;){var c=b.m_next;a.m_fixtureCount--,b.m_next=this.m_fixtureList,this.m_fixtureList=b,this.m_fixtureCount++,b.m_body=e,b=c}d.m_fixtureCount=0;var d=this,e=a;d.GetWorldCenter(),e.GetWorldCenter(),d.GetLinearVelocity().Copy(),e.GetLinearVelocity().Copy(),d.GetAngularVelocity(),e.GetAngularVelocity();d.ResetMassData(),this.SynchronizeFixtures()},q.prototype.GetMass=function(){return this.m_mass},q.prototype.GetInertia=function(){return this.m_I},q.prototype.GetMassData=function(a){a.mass=this.m_mass,a.I=this.m_I,a.center.SetV(this.m_sweep.localCenter)},q.prototype.SetMassData=function(b){if(f.b2Assert(0==this.m_world.IsLocked()),1!=this.m_world.IsLocked()&&this.m_type==q.b2_dynamicBody){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=b.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,b.I>0&&0==(this.m_flags&q.e_fixedRotationFlag)&&(this.m_I=b.I-this.m_mass*(b.center.x*b.center.x+b.center.y*b.center.y),this.m_invI=1/this.m_I);var c=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(b.center),this.m_sweep.c0.SetV(a.MulX(this.m_xf,this.m_sweep.localCenter)),this.m_sweep.c.SetV(this.m_sweep.c0),this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-c.y),this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-c.x)}},q.prototype.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type!=q.b2_staticBody&&this.m_type!=q.b2_kinematicBody){for(var b=d.Make(0,0),c=this.m_fixtureList;c;c=c.m_next)if(0!=c.m_density){var e=c.GetMassData();this.m_mass+=e.mass,b.x+=e.center.x*e.mass,b.y+=e.center.y*e.mass,this.m_I+=e.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,b.x*=this.m_invMass,b.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&0==(this.m_flags&q.e_fixedRotationFlag)?(this.m_I-=this.m_mass*(b.x*b.x+b.y*b.y),this.m_I*=this.m_inertiaScale,f.b2Assert(this.m_I>0),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var g=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(b),this.m_sweep.c0.SetV(a.MulX(this.m_xf,this.m_sweep.localCenter)),this.m_sweep.c.SetV(this.m_sweep.c0),this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-g.y),this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-g.x)}},q.prototype.GetWorldPoint=function(a){var b=this.m_xf.R,c=new d(b.col1.x*a.x+b.col2.x*a.y,b.col1.y*a.x+b.col2.y*a.y);return c.x+=this.m_xf.position.x,c.y+=this.m_xf.position.y,c},q.prototype.GetWorldVector=function(b){return a.MulMV(this.m_xf.R,b)},q.prototype.GetLocalPoint=function(b){return a.MulXT(this.m_xf,b)},q.prototype.GetLocalVector=function(b){return a.MulTMV(this.m_xf.R,b)},q.prototype.GetLinearVelocityFromWorldPoint=function(a){return new d(this.m_linearVelocity.x-this.m_angularVelocity*(a.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(a.x-this.m_sweep.c.x))},q.prototype.GetLinearVelocityFromLocalPoint=function(a){var b=this.m_xf.R,c=new d(b.col1.x*a.x+b.col2.x*a.y,b.col1.y*a.x+b.col2.y*a.y);return c.x+=this.m_xf.position.x,c.y+=this.m_xf.position.y,new d(this.m_linearVelocity.x-this.m_angularVelocity*(c.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(c.x-this.m_sweep.c.x))},q.prototype.GetLinearDamping=function(){return this.m_linearDamping},q.prototype.SetLinearDamping=function(a){void 0===a&&(a=0),this.m_linearDamping=a},q.prototype.GetAngularDamping=function(){return this.m_angularDamping},q.prototype.SetAngularDamping=function(a){void 0===a&&(a=0),this.m_angularDamping=a},q.prototype.SetType=function(a){if(void 0===a&&(a=0),this.m_type!=a){this.m_type=a,this.ResetMassData(),this.m_type==q.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var b=this.m_contactList;b;b=b.next)b.contact.FlagForFiltering()}},q.prototype.GetType=function(){return this.m_type},q.prototype.SetBullet=function(a){a?this.m_flags|=q.e_bulletFlag:this.m_flags&=~q.e_bulletFlag},q.prototype.IsBullet=function(){return(this.m_flags&q.e_bulletFlag)==q.e_bulletFlag},q.prototype.SetSleepingAllowed=function(a){a?this.m_flags|=q.e_allowSleepFlag:(this.m_flags&=~q.e_allowSleepFlag,this.SetAwake(!0))},q.prototype.SetAwake=function(a){a?(this.m_flags|=q.e_awakeFlag,this.m_sleepTime=0):(this.m_flags&=~q.e_awakeFlag,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},q.prototype.IsAwake=function(){return(this.m_flags&q.e_awakeFlag)==q.e_awakeFlag},q.prototype.SetFixedRotation=function(a){a?this.m_flags|=q.e_fixedRotationFlag:this.m_flags&=~q.e_fixedRotationFlag,this.ResetMassData()},q.prototype.IsFixedRotation=function(){return(this.m_flags&q.e_fixedRotationFlag)==q.e_fixedRotationFlag},q.prototype.SetActive=function(a){if(a!=this.IsActive()){var b,c;if(a)for(this.m_flags|=q.e_activeFlag,b=this.m_world.m_contactManager.m_broadPhase,c=this.m_fixtureList;c;c=c.m_next)c.CreateProxy(b,this.m_xf);else{for(this.m_flags&=~q.e_activeFlag,b=this.m_world.m_contactManager.m_broadPhase,c=this.m_fixtureList;c;c=c.m_next)c.DestroyProxy(b);for(var d=this.m_contactList;d;){var e=d;d=d.next,this.m_world.m_contactManager.Destroy(e.contact)}this.m_contactList=null}}},q.prototype.IsActive=function(){return(this.m_flags&q.e_activeFlag)==q.e_activeFlag},q.prototype.IsSleepingAllowed=function(){return(this.m_flags&q.e_allowSleepFlag)==q.e_allowSleepFlag},q.prototype.GetFixtureList=function(){return this.m_fixtureList},q.prototype.GetJointList=function(){return this.m_jointList},q.prototype.GetControllerList=function(){return this.m_controllerList},q.prototype.GetContactList=function(){return this.m_contactList},q.prototype.GetNext=function(){return this.m_next},q.prototype.GetUserData=function(){return this.m_userData},q.prototype.SetUserData=function(a){this.m_userData=a},q.prototype.GetWorld=function(){return this.m_world},q.prototype.b2Body=function(a,b){this.m_flags=0,a.bullet&&(this.m_flags|=q.e_bulletFlag),a.fixedRotation&&(this.m_flags|=q.e_fixedRotationFlag),a.allowSleep&&(this.m_flags|=q.e_allowSleepFlag),a.awake&&(this.m_flags|=q.e_awakeFlag),a.active&&(this.m_flags|=q.e_activeFlag),this.m_world=b,this.m_xf.position.SetV(a.position),this.m_xf.R.Set(a.angle),this.m_sweep.localCenter.SetZero(),this.m_sweep.t0=1,this.m_sweep.a0=this.m_sweep.a=a.angle;var c=this.m_xf.R,d=this.m_sweep.localCenter;this.m_sweep.c.x=c.col1.x*d.x+c.col2.x*d.y,this.m_sweep.c.y=c.col1.y*d.x+c.col2.y*d.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),this.m_jointList=null,this.m_controllerList=null,this.m_contactList=null,this.m_controllerCount=0,this.m_prev=null,this.m_next=null,this.m_linearVelocity.SetV(a.linearVelocity),this.m_angularVelocity=a.angularVelocity,this.m_linearDamping=a.linearDamping,this.m_angularDamping=a.angularDamping,this.m_force.Set(0,0),this.m_torque=0,this.m_sleepTime=0,this.m_type=a.type,this.m_type==q.b2_dynamicBody?(this.m_mass=1,this.m_invMass=1):(this.m_mass=0,this.m_invMass=0),this.m_I=0,this.m_invI=0,this.m_inertiaScale=a.inertiaScale,this.m_userData=a.userData,this.m_fixtureList=null,this.m_fixtureCount=0},q.prototype.SynchronizeFixtures=function(){var a=q.s_xf1;a.R.Set(this.m_sweep.a0);var b=a.R,c=this.m_sweep.localCenter;a.position.x=this.m_sweep.c0.x-(b.col1.x*c.x+b.col2.x*c.y),a.position.y=this.m_sweep.c0.y-(b.col1.y*c.x+b.col2.y*c.y);var d,e=this.m_world.m_contactManager.m_broadPhase;for(d=this.m_fixtureList;d;d=d.m_next)d.Synchronize(e,a,this.m_xf)},q.prototype.SynchronizeTransform=function(){this.m_xf.R.Set(this.m_sweep.a);var a=this.m_xf.R,b=this.m_sweep.localCenter;this.m_xf.position.x=this.m_sweep.c.x-(a.col1.x*b.x+a.col2.x*b.y),this.m_xf.position.y=this.m_sweep.c.y-(a.col1.y*b.x+a.col2.y*b.y)},q.prototype.ShouldCollide=function(a){if(this.m_type!=q.b2_dynamicBody&&a.m_type!=q.b2_dynamicBody)return!1;for(var b=this.m_jointList;b;b=b.next)if(b.other==a&&0==b.joint.m_collideConnected)return!1;return!0},q.prototype.Advance=function(a){void 0===a&&(a=0),this.m_sweep.Advance(a),this.m_sweep.c.SetV(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.SynchronizeTransform()},Box2D.postDefs.push(function(){Box2D.Dynamics.b2Body.s_xf1=new c,Box2D.Dynamics.b2Body.e_islandFlag=1,Box2D.Dynamics.b2Body.e_awakeFlag=2,Box2D.Dynamics.b2Body.e_allowSleepFlag=4,Box2D.Dynamics.b2Body.e_bulletFlag=8,Box2D.Dynamics.b2Body.e_fixedRotationFlag=16,Box2D.Dynamics.b2Body.e_activeFlag=32,Box2D.Dynamics.b2Body.b2_staticBody=0,Box2D.Dynamics.b2Body.b2_kinematicBody=1,Box2D.Dynamics.b2Body.b2_dynamicBody=2}),r.b2BodyDef=function(){this.position=new d,this.linearVelocity=new d},r.prototype.b2BodyDef=function(){this.userData=null,this.position.Set(0,0),this.angle=0,this.linearVelocity.Set(0,0),this.angularVelocity=0,this.linearDamping=0,this.angularDamping=0,this.allowSleep=!0,this.awake=!0,this.fixedRotation=!1,this.bullet=!1,this.type=q.b2_staticBody,this.active=!0,this.inertiaScale=1},s.b2ContactFilter=function(){},s.prototype.ShouldCollide=function(a,b){var c=a.GetFilterData(),d=b.GetFilterData();return c.groupIndex==d.groupIndex&&0!=c.groupIndex?c.groupIndex>0:0!=(c.maskBits&d.categoryBits)&&0!=(c.categoryBits&d.maskBits)},s.prototype.RayCollide=function(a,b){return!a||this.ShouldCollide(a instanceof z?a:null,b)},Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactFilter.b2_defaultFilter=new s}),t.b2ContactImpulse=function(){this.normalImpulses=new Vector_a2j_Number(f.b2_maxManifoldPoints),this.tangentImpulses=new Vector_a2j_Number(f.b2_maxManifoldPoints)},u.b2ContactListener=function(){},u.prototype.BeginContact=function(a){},u.prototype.EndContact=function(a){},u.prototype.PreSolve=function(a,b){},u.prototype.PostSolve=function(a,b){},Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactListener.b2_defaultListener=new u}),v.b2ContactManager=function(){},v.prototype.b2ContactManager=function(){this.m_world=null,this.m_contactCount=0,this.m_contactFilter=s.b2_defaultFilter,this.m_contactListener=u.b2_defaultListener,this.m_contactFactory=new F(this.m_allocator),this.m_broadPhase=new i},v.prototype.AddPair=function(a,b){var c=a instanceof z?a:null,d=b instanceof z?b:null,e=c.GetBody(),f=d.GetBody();if(e!=f){for(var g=f.GetContactList();g;){if(g.other==e){var h=g.contact.GetFixtureA(),i=g.contact.GetFixtureB();if(h==c&&i==d)return;if(h==d&&i==c)return}g=g.next}if(0!=f.ShouldCollide(e)&&0!=this.m_contactFilter.ShouldCollide(c,d)){var j=this.m_contactFactory.Create(c,d);c=j.GetFixtureA(),d=j.GetFixtureB(),e=c.m_body,f=d.m_body,j.m_prev=null,j.m_next=this.m_world.m_contactList,null!=this.m_world.m_contactList&&(this.m_world.m_contactList.m_prev=j),this.m_world.m_contactList=j,j.m_nodeA.contact=j,j.m_nodeA.other=f,j.m_nodeA.prev=null,j.m_nodeA.next=e.m_contactList,null!=e.m_contactList&&(e.m_contactList.prev=j.m_nodeA),e.m_contactList=j.m_nodeA,j.m_nodeB.contact=j,j.m_nodeB.other=e,j.m_nodeB.prev=null,j.m_nodeB.next=f.m_contactList,null!=f.m_contactList&&(f.m_contactList.prev=j.m_nodeB),f.m_contactList=j.m_nodeB,++this.m_world.m_contactCount}}},v.prototype.FindNewContacts=function(){this.m_broadPhase.UpdatePairs(Box2D.generateCallback(this,this.AddPair))},v.prototype.Destroy=function(a){var b=a.GetFixtureA(),c=a.GetFixtureB(),d=b.GetBody(),e=c.GetBody();a.IsTouching()&&this.m_contactListener.EndContact(a),a.m_prev&&(a.m_prev.m_next=a.m_next),a.m_next&&(a.m_next.m_prev=a.m_prev),a==this.m_world.m_contactList&&(this.m_world.m_contactList=a.m_next),a.m_nodeA.prev&&(a.m_nodeA.prev.next=a.m_nodeA.next),a.m_nodeA.next&&(a.m_nodeA.next.prev=a.m_nodeA.prev),a.m_nodeA==d.m_contactList&&(d.m_contactList=a.m_nodeA.next),a.m_nodeB.prev&&(a.m_nodeB.prev.next=a.m_nodeB.next),a.m_nodeB.next&&(a.m_nodeB.next.prev=a.m_nodeB.prev),a.m_nodeB==e.m_contactList&&(e.m_contactList=a.m_nodeB.next),this.m_contactFactory.Destroy(a),--this.m_contactCount},v.prototype.Collide=function(){for(var a=this.m_world.m_contactList;a;){var b=a.GetFixtureA(),c=a.GetFixtureB(),d=b.GetBody(),e=c.GetBody();if(0!=d.IsAwake()||0!=e.IsAwake()){if(a.m_flags&E.e_filterFlag){if(0==e.ShouldCollide(d)){var f=a;a=f.GetNext(),this.Destroy(f);continue}if(0==this.m_contactFilter.ShouldCollide(b,c)){f=a,a=f.GetNext(),this.Destroy(f);continue}a.m_flags&=~E.e_filterFlag}var g=b.m_proxy,h=c.m_proxy;0!=this.m_broadPhase.TestOverlap(g,h)?(a.Update(this.m_contactListener),a=a.GetNext()):(f=a,a=f.GetNext(),this.Destroy(f))}else a=a.GetNext()}},Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactManager.s_evalCP=new h}),w.b2DebugDraw=function(){},w.prototype.b2DebugDraw=function(){},w.prototype.SetFlags=function(a){void 0===a&&(a=0)},w.prototype.GetFlags=function(){},w.prototype.AppendFlags=function(a){void 0===a&&(a=0)},w.prototype.ClearFlags=function(a){void 0===a&&(a=0)},w.prototype.SetSprite=function(a){},w.prototype.GetSprite=function(){},w.prototype.SetDrawScale=function(a){void 0===a&&(a=0)},w.prototype.GetDrawScale=function(){},w.prototype.SetLineThickness=function(a){void 0===a&&(a=0)},w.prototype.GetLineThickness=function(){},w.prototype.SetAlpha=function(a){void 0===a&&(a=0)},w.prototype.GetAlpha=function(){},w.prototype.SetFillAlpha=function(a){void 0===a&&(a=0)},w.prototype.GetFillAlpha=function(){},w.prototype.SetXFormScale=function(a){void 0===a&&(a=0)},w.prototype.GetXFormScale=function(){},w.prototype.DrawPolygon=function(a,b,c){void 0===b&&(b=0)},w.prototype.DrawSolidPolygon=function(a,b,c){void 0===b&&(b=0)},w.prototype.DrawCircle=function(a,b,c){void 0===b&&(b=0)},w.prototype.DrawSolidCircle=function(a,b,c,d){void 0===b&&(b=0)},w.prototype.DrawSegment=function(a,b,c){},w.prototype.DrawTransform=function(a){},Box2D.postDefs.push(function(){Box2D.Dynamics.b2DebugDraw.e_shapeBit=1,Box2D.Dynamics.b2DebugDraw.e_jointBit=2,Box2D.Dynamics.b2DebugDraw.e_aabbBit=4,Box2D.Dynamics.b2DebugDraw.e_pairBit=8,Box2D.Dynamics.b2DebugDraw.e_centerOfMassBit=16,Box2D.Dynamics.b2DebugDraw.e_controllerBit=32}),x.b2DestructionListener=function(){},x.prototype.SayGoodbyeJoint=function(a){},x.prototype.SayGoodbyeFixture=function(a){},y.b2FilterData=function(){this.categoryBits=1,this.maskBits=65535,this.groupIndex=0},y.prototype.Copy=function(){var a=new y;return a.categoryBits=this.categoryBits,a.maskBits=this.maskBits,a.groupIndex=this.groupIndex,a},z.b2Fixture=function(){this.m_filter=new y},z.prototype.GetType=function(){return this.m_shape.GetType()},z.prototype.GetShape=function(){return this.m_shape},z.prototype.SetSensor=function(a){if(this.m_isSensor!=a&&(this.m_isSensor=a,null!=this.m_body))for(var b=this.m_body.GetContactList();b;){var c=b.contact,d=c.GetFixtureA(),e=c.GetFixtureB();d!=this&&e!=this||c.SetSensor(d.IsSensor()||e.IsSensor()),b=b.next}},z.prototype.IsSensor=function(){return this.m_isSensor},z.prototype.SetFilterData=function(a){if(this.m_filter=a.Copy(),!this.m_body)for(var b=this.m_body.GetContactList();b;){var c=b.contact,d=c.GetFixtureA(),e=c.GetFixtureB();d!=this&&e!=this||c.FlagForFiltering(),b=b.next}},z.prototype.GetFilterData=function(){return this.m_filter.Copy()},z.prototype.GetBody=function(){return this.m_body},z.prototype.GetNext=function(){return this.m_next},z.prototype.GetUserData=function(){return this.m_userData},z.prototype.SetUserData=function(a){this.m_userData=a},z.prototype.TestPoint=function(a){return this.m_shape.TestPoint(this.m_body.GetTransform(),a)},z.prototype.RayCast=function(a,b){return this.m_shape.RayCast(a,b,this.m_body.GetTransform())},z.prototype.GetMassData=function(a){return void 0===a&&(a=null),null==a&&(a=new n),this.m_shape.ComputeMass(a,this.m_density),a},z.prototype.SetDensity=function(a){void 0===a&&(a=0),this.m_density=a},z.prototype.GetDensity=function(){return this.m_density},z.prototype.GetFriction=function(){return this.m_friction},z.prototype.SetFriction=function(a){void 0===a&&(a=0),this.m_friction=a},z.prototype.GetRestitution=function(){return this.m_restitution},z.prototype.SetRestitution=function(a){void 0===a&&(a=0),this.m_restitution=a},z.prototype.GetAABB=function(){return this.m_aabb},z.prototype.b2Fixture=function(){this.m_aabb=new g,this.m_userData=null,this.m_body=null,this.m_next=null,this.m_shape=null,this.m_density=0,this.m_friction=0,this.m_restitution=0},z.prototype.Create=function(a,b,c){this.m_userData=c.userData,this.m_friction=c.friction,this.m_restitution=c.restitution,this.m_body=a,this.m_next=null,this.m_filter=c.filter.Copy(),this.m_isSensor=c.isSensor,this.m_shape=c.shape.Copy(),this.m_density=c.density},z.prototype.Destroy=function(){this.m_shape=null},z.prototype.CreateProxy=function(a,b){this.m_shape.ComputeAABB(this.m_aabb,b),this.m_proxy=a.CreateProxy(this.m_aabb,this)},z.prototype.DestroyProxy=function(a){null!=this.m_proxy&&(a.DestroyProxy(this.m_proxy),this.m_proxy=null)},z.prototype.Synchronize=function(b,c,d){if(this.m_proxy){var e=new g,f=new g;this.m_shape.ComputeAABB(e,c),this.m_shape.ComputeAABB(f,d),this.m_aabb.Combine(e,f);var h=a.SubtractVV(d.position,c.position);b.MoveProxy(this.m_proxy,this.m_aabb,h)}},A.b2FixtureDef=function(){this.filter=new y},A.prototype.b2FixtureDef=function(){this.shape=null,this.userData=null,this.friction=.2,this.restitution=0,this.density=0,this.filter.categoryBits=1,this.filter.maskBits=65535,this.filter.groupIndex=0,this.isSensor=!1},B.b2Island=function(){},B.prototype.b2Island=function(){this.m_bodies=new Vector,this.m_contacts=new Vector,this.m_joints=new Vector},B.prototype.Initialize=function(a,b,c,d,e,f){void 0===a&&(a=0),void 0===b&&(b=0),void 0===c&&(c=0);var g=0;for(this.m_bodyCapacity=a,this.m_contactCapacity=b,this.m_jointCapacity=c,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_allocator=d,this.m_listener=e,this.m_contactSolver=f,g=this.m_bodies.length;gf.b2_maxTranslationSquared&&(e.m_linearVelocity.Normalize(),e.m_linearVelocity.x*=f.b2_maxTranslation*b.inv_dt,e.m_linearVelocity.y*=f.b2_maxTranslation*b.inv_dt);var m=b.dt*e.m_angularVelocity;m*m>f.b2_maxRotationSquared&&(e.m_angularVelocity<0?e.m_angularVelocity=-f.b2_maxRotation*b.inv_dt:e.m_angularVelocity=f.b2_maxRotation*b.inv_dt),e.m_sweep.c0.SetV(e.m_sweep.c),e.m_sweep.a0=e.m_sweep.a,e.m_sweep.c.x+=b.dt*e.m_linearVelocity.x,e.m_sweep.c.y+=b.dt*e.m_linearVelocity.y,e.m_sweep.a+=b.dt*e.m_angularVelocity,e.SynchronizeTransform()}for(h=0;h t||a.Dot(e.m_linearVelocity,e.m_linearVelocity)>s?(e.m_sleepTime=0,r=0):(e.m_sleepTime+=b.dt,r=a.Min(r,e.m_sleepTime)));if(r>=f.b2_timeToSleep)for(h=0;h f.b2_maxTranslationSquared&&(e.m_linearVelocity.Normalize(),e.m_linearVelocity.x*=f.b2_maxTranslation*a.inv_dt,e.m_linearVelocity.y*=f.b2_maxTranslation*a.inv_dt);var i=a.dt*e.m_angularVelocity;i*i>f.b2_maxRotationSquared&&(e.m_angularVelocity<0?e.m_angularVelocity=-f.b2_maxRotation*a.inv_dt:e.m_angularVelocity=f.b2_maxRotation*a.inv_dt),e.m_sweep.c0.SetV(e.m_sweep.c),e.m_sweep.a0=e.m_sweep.a,e.m_sweep.c.x+=a.dt*e.m_linearVelocity.x,e.m_sweep.c.y+=a.dt*e.m_linearVelocity.y,e.m_sweep.a+=a.dt*e.m_angularVelocity,e.SynchronizeTransform()}}for(b=0;b 0?1/a:0,d.dtRatio=this.m_inv_dt0*a,d.warmStarting=D.m_warmStarting,this.m_contactManager.Collide(),d.dt>0&&this.Solve(d),D.m_continuousPhysics&&d.dt>0&&this.SolveTOI(d),d.dt>0&&(this.m_inv_dt0=d.inv_dt),this.m_flags&=~D.e_locked},D.prototype.ClearForces=function(){for(var a=this.m_bodyList;a;a=a.m_next)a.m_force.SetZero(),a.m_torque=0},D.prototype.DrawDebugData=function(){if(null!=this.m_debugDraw){this.m_debugDraw.m_sprite.graphics.clear();var a,b,c,f,h,i,j=this.m_debugDraw.GetFlags(),k=(new d,new d,new d,new g,new g,[new d,new d,new d,new d]),l=new e(0,0,0);if(j&w.e_shapeBit)for(a=this.m_bodyList;a;a=a.m_next)for(i=a.m_xf,b=a.GetFixtureList();b;b=b.m_next)c=b.GetShape(),0==a.IsActive()?(l.Set(.5,.5,.3),this.DrawShape(c,i,l)):a.GetType()==q.b2_staticBody?(l.Set(.5,.9,.5),this.DrawShape(c,i,l)):a.GetType()==q.b2_kinematicBody?(l.Set(.5,.5,.9),this.DrawShape(c,i,l)):0==a.IsAwake()?(l.Set(.6,.6,.6),this.DrawShape(c,i,l)):(l.Set(.9,.7,.7),this.DrawShape(c,i,l));if(j&w.e_jointBit)for(f=this.m_jointList;f;f=f.m_next)this.DrawJoint(f);if(j&w.e_controllerBit)for(var m=this.m_controllerList;m;m=m.m_next)m.Draw(this.m_debugDraw);if(j&w.e_pairBit){l.Set(.3,.9,.9);for(var n=this.m_contactManager.m_contactList;n;n=n.GetNext()){var o=n.GetFixtureA(),p=n.GetFixtureB(),r=o.GetAABB().GetCenter(),s=p.GetAABB().GetCenter();this.m_debugDraw.DrawSegment(r,s,l)}}if(j&w.e_aabbBit)for(h=this.m_contactManager.m_broadPhase,k=[new d,new d,new d,new d],a=this.m_bodyList;a;a=a.GetNext())if(0!=a.IsActive())for(b=a.GetFixtureList();b;b=b.GetNext()){var t=h.GetFatAABB(b.m_proxy);k[0].Set(t.lowerBound.x,t.lowerBound.y),k[1].Set(t.upperBound.x,t.lowerBound.y),k[2].Set(t.upperBound.x,t.upperBound.y),k[3].Set(t.lowerBound.x,t.upperBound.y),this.m_debugDraw.DrawPolygon(k,4,l)}if(j&w.e_centerOfMassBit)for(a=this.m_bodyList;a;a=a.m_next)i=D.s_xf,i.R=a.m_xf.R,i.position=a.GetWorldCenter(),this.m_debugDraw.DrawTransform(i)}},D.prototype.QueryAABB=function(a,b){function c(b){return a(e.GetUserData(b))}var d=this,e=d.m_contactManager.m_broadPhase;e.Query(c,b)},D.prototype.QueryShape=function(a,b,d){function e(c){var e=h.GetUserData(c)instanceof z?h.GetUserData(c):null;return!p.TestOverlap(b,d,e.GetShape(),e.GetBody().GetTransform())||a(e)}var f=this;void 0===d&&(d=null),null==d&&(d=new c,d.SetIdentity());var h=f.m_contactManager.m_broadPhase,i=new g;b.ComputeAABB(i,d),h.Query(e,i)},D.prototype.QueryPoint=function(a,b){function c(c){var d=e.GetUserData(c)instanceof z?e.GetUserData(c):null;return!d.TestPoint(b)||a(d)}var d=this,e=d.m_contactManager.m_broadPhase,h=new g;h.lowerBound.Set(b.x-f.b2_linearSlop,b.y-f.b2_linearSlop),h.upperBound.Set(b.x+f.b2_linearSlop,b.y+f.b2_linearSlop),e.Query(c,h)},D.prototype.RayCast=function(a,b,c){function e(e,f){var i=g.GetUserData(f),j=i instanceof z?i:null;if(j.RayCast(h,e)){var k=h.fraction,l=new d((1-k)*b.x+k*c.x,(1-k)*b.y+k*c.y);return a(j,l,h.normal,k)}return e.maxFraction}var f=this,g=f.m_contactManager.m_broadPhase,h=new k,i=new j(b,c);g.RayCast(e,i)},D.prototype.RayCastOne=function(a,b){function c(a,b,c,e){return void 0===e&&(e=0),d=a,e}var d,e=this;return e.RayCast(c,a,b),d},D.prototype.RayCastAll=function(a,b){function c(a,b,c,d){return void 0===d&&(d=0),e[e.length]=a,1}var d=this,e=new Vector;return d.RayCast(c,a,b),e},D.prototype.GetBodyList=function(){return this.m_bodyList},D.prototype.GetJointList=function(){return this.m_jointList},D.prototype.GetContactList=function(){return this.m_contactList},D.prototype.IsLocked=function(){return(this.m_flags&D.e_locked)>0},D.prototype.Solve=function(a){for(var b,c=this.m_controllerList;c;c=c.m_next)c.Step(a);var d=this.m_island;for(d.Initialize(this.m_bodyCount,this.m_contactCount,this.m_jointCount,null,this.m_contactManager.m_contactListener,this.m_contactSolver),b=this.m_bodyList;b;b=b.m_next)b.m_flags&=~q.e_islandFlag;for(var e=this.m_contactList;e;e=e.m_next)e.m_flags&=~E.e_islandFlag;for(var f=this.m_jointList;f;f=f.m_next)f.m_islandFlag=!1;for(var g=(parseInt(this.m_bodyCount),this.s_stack),h=this.m_bodyList;h;h=h.m_next)if(!(h.m_flags&q.e_islandFlag)&&0!=h.IsAwake()&&0!=h.IsActive()&&h.GetType()!=q.b2_staticBody){d.Clear();var i=0;for(g[i++]=h,h.m_flags|=q.e_islandFlag;i>0;)if(b=g[--i],d.AddBody(b),0==b.IsAwake()&&b.SetAwake(!0),b.GetType()!=q.b2_staticBody){for(var j,k=b.m_contactList;k;k=k.next)k.contact.m_flags&E.e_islandFlag||1!=k.contact.IsSensor()&&0!=k.contact.IsEnabled()&&0!=k.contact.IsTouching()&&(d.AddContact(k.contact),k.contact.m_flags|=E.e_islandFlag,j=k.other,j.m_flags&q.e_islandFlag||(g[i++]=j,j.m_flags|=q.e_islandFlag));for(var l=b.m_jointList;l;l=l.next)1!=l.joint.m_islandFlag&&(j=l.other,0!=j.IsActive()&&(d.AddJoint(l.joint),l.joint.m_islandFlag=!0,j.m_flags&q.e_islandFlag||(g[i++]=j,j.m_flags|=q.e_islandFlag)))}d.Solve(a,this.m_gravity,this.m_allowSleep);for(var m=0;m 0&&o<1&&(o=(1-o)*p+o)>1&&(o=1),l.m_toi=o,l.m_flags|=E.e_toiFlag}Number.MIN_VALUE 0;)if(b=k[s++],--t,j.AddBody(b),0==b.IsAwake()&&b.SetAwake(!0),b.GetType()==q.b2_dynamicBody){for(h=b.m_contactList;h&&j.m_contactCount!=j.m_contactCapacity;h=h.next)if(!(h.contact.m_flags&E.e_islandFlag)&&1!=h.contact.IsSensor()&&0!=h.contact.IsEnabled()&&0!=h.contact.IsTouching()){j.AddContact(h.contact),h.contact.m_flags|=E.e_islandFlag;var u=h.other;u.m_flags&q.e_islandFlag||(u.GetType()!=q.b2_staticBody&&(u.Advance(n),u.SetAwake(!0)),k[s+t]=u,++t,u.m_flags|=q.e_islandFlag)}for(var v=b.m_jointList;v;v=v.next)j.m_jointCount!=j.m_jointCapacity&&1!=v.joint.m_islandFlag&&(u=v.other,0!=u.IsActive()&&(j.AddJoint(v.joint),v.joint.m_islandFlag=!0,u.m_flags&q.e_islandFlag||(u.GetType()!=q.b2_staticBody&&(u.Advance(n),u.SetAwake(!0)),k[s+t]=u,++t,u.m_flags|=q.e_islandFlag)))}var w=D.s_timestep;w.warmStarting=!1,w.dt=(1-n)*a.dt,w.inv_dt=1/w.dt,w.dtRatio=0,w.velocityIterations=a.velocityIterations,w.positionIterations=a.positionIterations,j.SolveTOI(w);var x=0;for(x=0;x 0;for(var n=0;n 0&&(a.m_fixtureA.m_body.SetAwake(!0),a.m_fixtureB.m_body.SetAwake(!0));var b=parseInt(a.m_fixtureA.GetType()),c=parseInt(a.m_fixtureB.GetType()),d=this.m_registers[b][c];d.poolCount++,a.m_next=d.pool,d.pool=a,(0,d.destroyFcn)(a,this.m_allocator)},k.b2ContactRegister=function(){},l.b2ContactResult=function(){this.position=new y,this.normal=new y,this.id=new A},m.b2ContactSolver=function(){this.m_step=new u,this.m_constraints=new Vector},m.prototype.b2ContactSolver=function(){},m.prototype.Initialize=function(a,b,c,d){void 0===c&&(c=0);var e;this.m_step.Set(a),this.m_allocator=d;var f=0;for(this.m_constraintCount=c;this.m_constraints.length 0),m.s_worldManifold.Initialize(q,o.m_xf,l,p.m_xf,n);var A=m.s_worldManifold.m_normal.x,B=m.s_worldManifold.m_normal.y,C=this.m_constraints[f];C.bodyA=o,C.bodyB=p,C.manifold=q,C.normal.x=A,C.normal.y=B,C.pointCount=q.m_pointCount,C.friction=r,C.restitution=s,C.localPlaneNormal.x=q.m_localPlaneNormal.x,C.localPlaneNormal.y=q.m_localPlaneNormal.y,C.localPoint.x=q.m_localPoint.x,C.localPoint.y=q.m_localPoint.y,C.radius=l+n,C.type=q.m_type;for(var D=0;D 0?j:0,h=j-a.normalImpulse,k=h*F,l=h*G,z.x-=B*k,z.y-=B*l,w-=C*(a.rA.x*l-a.rA.y*k),A.x+=D*k,A.y+=D*l,y+=E*(a.rB.x*l-a.rB.y*k),a.normalImpulse=j;else{var K=t.points[0],L=t.points[1],M=K.normalImpulse,N=L.normalImpulse,O=A.x-y*K.rB.y-z.x+w*K.rA.y,P=A.y+y*K.rB.x-z.y-w*K.rA.x,Q=A.x-y*L.rB.y-z.x+w*L.rA.y,R=A.y+y*L.rB.x-z.y-w*L.rA.x,S=O*F+P*G,T=Q*F+R*G,U=S-K.velocityBias,V=T-L.velocityBias;b=t.K,U-=b.col1.x*M+b.col2.x*N,V-=b.col1.y*M+b.col2.y*N;for(;;){b=t.normalMass;var W=-(b.col1.x*U+b.col2.x*V),X=-(b.col1.y*U+b.col2.y*V);if(W>=0&&X>=0){m=W-M,n=X-N,o=m*F,p=m*G,q=n*F,r=n*G,z.x-=B*(o+q),z.y-=B*(p+r),w-=C*(K.rA.x*p-K.rA.y*o+L.rA.x*r-L.rA.y*q),A.x+=D*(o+q),A.y+=D*(p+r),y+=E*(K.rB.x*p-K.rB.y*o+L.rB.x*r-L.rB.y*q),K.normalImpulse=W,L.normalImpulse=X;break}if(W=-K.normalMass*U,X=0,S=0,T=t.K.col1.y*W+V,W>=0&&T>=0){m=W-M,n=X-N,o=m*F,p=m*G,q=n*F,r=n*G,z.x-=B*(o+q),z.y-=B*(p+r),w-=C*(K.rA.x*p-K.rA.y*o+L.rA.x*r-L.rA.y*q),A.x+=D*(o+q),A.y+=D*(p+r),y+=E*(K.rB.x*p-K.rB.y*o+L.rB.x*r-L.rB.y*q),K.normalImpulse=W,L.normalImpulse=X;break}if(W=0,X=-L.normalMass*V,S=t.K.col2.x*X+U,T=0,X>=0&&S>=0){m=W-M,n=X-N,o=m*F,p=m*G,q=n*F,r=n*G,z.x-=B*(o+q),z.y-=B*(p+r),w-=C*(K.rA.x*p-K.rA.y*o+L.rA.x*r-L.rA.y*q),A.x+=D*(o+q),A.y+=D*(p+r),y+=E*(K.rB.x*p-K.rB.y*o+L.rB.x*r-L.rB.y*q),K.normalImpulse=W,L.normalImpulse=X;break}if(W=0,X=0,S=U,T=V,S>=0&&T>=0){m=W-M,n=X-N,o=m*F,p=m*G,q=n*F,r=n*G,z.x-=B*(o+q),z.y-=B*(p+r),w-=C*(K.rA.x*p-K.rA.y*o+L.rA.x*r-L.rA.y*q),A.x+=D*(o+q),A.y+=D*(p+r),y+=E*(K.rB.x*p-K.rB.y*o+L.rB.x*r-L.rB.y*q),K.normalImpulse=W,L.normalImpulse=X;break}break}}u.m_angularVelocity=w,v.m_angularVelocity=y}},m.prototype.FinalizeVelocityConstraints=function(){for(var a=0;a -1.5*v.b2_linearSlop},Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold=new E,Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new s}),Box2D.inherit(n,Box2D.Dynamics.Contacts.b2Contact),n.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype,n.b2EdgeAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)},n.Create=function(a){return new n},n.Destroy=function(a,b){},n.prototype.Reset=function(a,b){this.__super.Reset.call(this,a,b)},n.prototype.Evaluate=function(){var c=this.m_fixtureA.GetBody(),d=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof b?this.m_fixtureA.GetShape():null,c.m_xf,this.m_fixtureB.GetShape()instanceof a?this.m_fixtureB.GetShape():null,d.m_xf)},n.prototype.b2CollideEdgeAndCircle=function(a,b,c,d,e){},Box2D.inherit(o,Box2D.Dynamics.Contacts.b2Contact),o.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype,o.b2NullContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)},o.prototype.b2NullContact=function(){this.__super.b2Contact.call(this)},o.prototype.Evaluate=function(){},Box2D.inherit(p,Box2D.Dynamics.Contacts.b2Contact),p.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype,p.b2PolyAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)},p.Create=function(a){return new p},p.Destroy=function(a,b){},p.prototype.Reset=function(a,b){this.__super.Reset.call(this,a,b),v.b2Assert(a.GetType()==d.e_polygonShape),v.b2Assert(b.GetType()==d.e_circleShape)},p.prototype.Evaluate=function(){var b=this.m_fixtureA.m_body,d=this.m_fixtureB.m_body;z.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof c?this.m_fixtureA.GetShape():null,b.m_xf,this.m_fixtureB.GetShape()instanceof a?this.m_fixtureB.GetShape():null,d.m_xf)},Box2D.inherit(q,Box2D.Dynamics.Contacts.b2Contact),q.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype,q.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)},q.Create=function(a){return new q},q.Destroy=function(a,b){},q.prototype.Reset=function(a,b){this.__super.Reset.call(this,a,b),v.b2Assert(a.GetType()==d.e_polygonShape),v.b2Assert(b.GetType()==d.e_edgeShape)},q.prototype.Evaluate=function(){var a=this.m_fixtureA.GetBody(),d=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape()instanceof c?this.m_fixtureA.GetShape():null,a.m_xf,this.m_fixtureB.GetShape()instanceof b?this.m_fixtureB.GetShape():null,d.m_xf)},q.prototype.b2CollidePolyAndEdge=function(a,b,c,d,e){},Box2D.inherit(r,Box2D.Dynamics.Contacts.b2Contact),r.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype,r.b2PolygonContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)},r.Create=function(a){return new r},r.Destroy=function(a,b){},r.prototype.Reset=function(a,b){this.__super.Reset.call(this,a,b)},r.prototype.Evaluate=function(){var a=this.m_fixtureA.GetBody(),b=this.m_fixtureB.GetBody();z.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape()instanceof c?this.m_fixtureA.GetShape():null,a.m_xf,this.m_fixtureB.GetShape()instanceof c?this.m_fixtureB.GetShape():null,b.m_xf)},s.b2PositionSolverManifold=function(){},s.prototype.b2PositionSolverManifold=function(){this.m_normal=new y,this.m_separations=new Vector_a2j_Number(v.b2_maxManifoldPoints),this.m_points=new Vector(v.b2_maxManifoldPoints);for(var a=0;a 0);var b,c,d=0,e=0,f=0,g=0,h=0;switch(a.type){case B.e_circles:b=a.bodyA.m_xf.R,c=a.localPoint;var i=a.bodyA.m_xf.position.x+(b.col1.x*c.x+b.col2.x*c.y),j=a.bodyA.m_xf.position.y+(b.col1.y*c.x+b.col2.y*c.y);b=a.bodyB.m_xf.R,c=a.points[0].localPoint;var k=a.bodyB.m_xf.position.x+(b.col1.x*c.x+b.col2.x*c.y),l=a.bodyB.m_xf.position.y+(b.col1.y*c.x+b.col2.y*c.y),m=k-i,n=l-j,o=m*m+n*n;if(o>Number.MIN_VALUE*Number.MIN_VALUE){var p=Math.sqrt(o);this.m_normal.x=m/p, this.m_normal.y=n/p}else this.m_normal.x=1,this.m_normal.y=0;this.m_points[0].x=.5*(i+k),this.m_points[0].y=.5*(j+l),this.m_separations[0]=m*this.m_normal.x+n*this.m_normal.y-a.radius;break;case B.e_faceA:for(b=a.bodyA.m_xf.R,c=a.localPlaneNormal,this.m_normal.x=b.col1.x*c.x+b.col2.x*c.y,this.m_normal.y=b.col1.y*c.x+b.col2.y*c.y,b=a.bodyA.m_xf.R,c=a.localPoint,g=a.bodyA.m_xf.position.x+(b.col1.x*c.x+b.col2.x*c.y),h=a.bodyA.m_xf.position.y+(b.col1.y*c.x+b.col2.y*c.y),b=a.bodyB.m_xf.R,d=0;d 0||b>0?1/Math.max(a,b):0},k.prototype.Step=function(a){var d=a.dt;if(!(d<=Number.MIN_VALUE)){d>this.maxTimestep&&this.maxTimestep>0&&(d=this.maxTimestep);for(var e=this.m_bodyList;e;e=e.nextBody){var f=e.body;if(f.IsAwake()){var g=f.GetWorldVector(b.MulMV(this.T,f.GetLocalVector(f.GetLinearVelocity())));f.SetLinearVelocity(new c(f.GetLinearVelocity().x+g.x*d,f.GetLinearVelocity().y+g.y*d))}}}}}(),function(){var a=(Box2D.Common.b2Color,Box2D.Common.b2internal,Box2D.Common.b2Settings),b=Box2D.Common.Math.b2Mat22,c=Box2D.Common.Math.b2Mat33,d=Box2D.Common.Math.b2Math,e=(Box2D.Common.Math.b2Sweep,Box2D.Common.Math.b2Transform,Box2D.Common.Math.b2Vec2),f=Box2D.Common.Math.b2Vec3,g=Box2D.Dynamics.Joints.b2DistanceJoint,h=Box2D.Dynamics.Joints.b2DistanceJointDef,i=Box2D.Dynamics.Joints.b2FrictionJoint,j=Box2D.Dynamics.Joints.b2FrictionJointDef,k=Box2D.Dynamics.Joints.b2GearJoint,l=Box2D.Dynamics.Joints.b2GearJointDef,m=Box2D.Dynamics.Joints.b2Jacobian,n=Box2D.Dynamics.Joints.b2Joint,o=Box2D.Dynamics.Joints.b2JointDef,p=Box2D.Dynamics.Joints.b2JointEdge,q=Box2D.Dynamics.Joints.b2LineJoint,r=Box2D.Dynamics.Joints.b2LineJointDef,s=Box2D.Dynamics.Joints.b2MouseJoint,t=Box2D.Dynamics.Joints.b2MouseJointDef,u=Box2D.Dynamics.Joints.b2PrismaticJoint,v=Box2D.Dynamics.Joints.b2PrismaticJointDef,w=Box2D.Dynamics.Joints.b2PulleyJoint,x=Box2D.Dynamics.Joints.b2PulleyJointDef,y=Box2D.Dynamics.Joints.b2RevoluteJoint,z=Box2D.Dynamics.Joints.b2RevoluteJointDef,A=Box2D.Dynamics.Joints.b2WeldJoint,B=Box2D.Dynamics.Joints.b2WeldJointDef;Box2D.Dynamics.b2Body,Box2D.Dynamics.b2BodyDef,Box2D.Dynamics.b2ContactFilter,Box2D.Dynamics.b2ContactImpulse,Box2D.Dynamics.b2ContactListener,Box2D.Dynamics.b2ContactManager,Box2D.Dynamics.b2DebugDraw,Box2D.Dynamics.b2DestructionListener,Box2D.Dynamics.b2FilterData,Box2D.Dynamics.b2Fixture,Box2D.Dynamics.b2FixtureDef,Box2D.Dynamics.b2Island,Box2D.Dynamics.b2TimeStep,Box2D.Dynamics.b2World;Box2D.inherit(g,Box2D.Dynamics.Joints.b2Joint),g.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype,g.b2DistanceJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments),this.m_localAnchor1=new e,this.m_localAnchor2=new e,this.m_u=new e},g.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},g.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},g.prototype.GetReactionForce=function(a){return void 0===a&&(a=0),new e(a*this.m_impulse*this.m_u.x,a*this.m_impulse*this.m_u.y)},g.prototype.GetReactionTorque=function(a){return void 0===a&&(a=0),0},g.prototype.GetLength=function(){return this.m_length},g.prototype.SetLength=function(a){void 0===a&&(a=0),this.m_length=a},g.prototype.GetFrequency=function(){return this.m_frequencyHz},g.prototype.SetFrequency=function(a){void 0===a&&(a=0),this.m_frequencyHz=a},g.prototype.GetDampingRatio=function(){return this.m_dampingRatio},g.prototype.SetDampingRatio=function(a){void 0===a&&(a=0),this.m_dampingRatio=a},g.prototype.b2DistanceJoint=function(a){this.__super.b2Joint.call(this,a);this.m_localAnchor1.SetV(a.localAnchorA),this.m_localAnchor2.SetV(a.localAnchorB),this.m_length=a.length,this.m_frequencyHz=a.frequencyHz,this.m_dampingRatio=a.dampingRatio,this.m_impulse=0,this.m_gamma=0,this.m_bias=0},g.prototype.InitVelocityConstraints=function(b){var c,d=0,e=this.m_bodyA,f=this.m_bodyB;c=e.m_xf.R;var g=this.m_localAnchor1.x-e.m_sweep.localCenter.x,h=this.m_localAnchor1.y-e.m_sweep.localCenter.y;d=c.col1.x*g+c.col2.x*h,h=c.col1.y*g+c.col2.y*h,g=d,c=f.m_xf.R;var i=this.m_localAnchor2.x-f.m_sweep.localCenter.x,j=this.m_localAnchor2.y-f.m_sweep.localCenter.y;d=c.col1.x*i+c.col2.x*j,j=c.col1.y*i+c.col2.y*j,i=d,this.m_u.x=f.m_sweep.c.x+i-e.m_sweep.c.x-g,this.m_u.y=f.m_sweep.c.y+j-e.m_sweep.c.y-h;var k=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);k>a.b2_linearSlop?this.m_u.Multiply(1/k):this.m_u.SetZero();var l=g*this.m_u.y-h*this.m_u.x,m=i*this.m_u.y-j*this.m_u.x,n=e.m_invMass+e.m_invI*l*l+f.m_invMass+f.m_invI*m*m;if(this.m_mass=0!=n?1/n:0,this.m_frequencyHz>0){var o=k-this.m_length,p=2*Math.PI*this.m_frequencyHz,q=2*this.m_mass*this.m_dampingRatio*p,r=this.m_mass*p*p;this.m_gamma=b.dt*(q+b.dt*r),this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0,this.m_bias=o*b.dt*r*this.m_gamma,this.m_mass=n+this.m_gamma,this.m_mass=0!=this.m_mass?1/this.m_mass:0}if(b.warmStarting){this.m_impulse*=b.dtRatio;var s=this.m_impulse*this.m_u.x,t=this.m_impulse*this.m_u.y;e.m_linearVelocity.x-=e.m_invMass*s,e.m_linearVelocity.y-=e.m_invMass*t,e.m_angularVelocity-=e.m_invI*(g*t-h*s),f.m_linearVelocity.x+=f.m_invMass*s,f.m_linearVelocity.y+=f.m_invMass*t,f.m_angularVelocity+=f.m_invI*(i*t-j*s)}else this.m_impulse=0},g.prototype.SolveVelocityConstraints=function(a){var b,c=this.m_bodyA,d=this.m_bodyB;b=c.m_xf.R;var e=this.m_localAnchor1.x-c.m_sweep.localCenter.x,f=this.m_localAnchor1.y-c.m_sweep.localCenter.y,g=b.col1.x*e+b.col2.x*f;f=b.col1.y*e+b.col2.y*f,e=g,b=d.m_xf.R;var h=this.m_localAnchor2.x-d.m_sweep.localCenter.x,i=this.m_localAnchor2.y-d.m_sweep.localCenter.y;g=b.col1.x*h+b.col2.x*i,i=b.col1.y*h+b.col2.y*i,h=g;var j=c.m_linearVelocity.x+-c.m_angularVelocity*f,k=c.m_linearVelocity.y+c.m_angularVelocity*e,l=d.m_linearVelocity.x+-d.m_angularVelocity*i,m=d.m_linearVelocity.y+d.m_angularVelocity*h,n=this.m_u.x*(l-j)+this.m_u.y*(m-k),o=-this.m_mass*(n+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=o;var p=o*this.m_u.x,q=o*this.m_u.y;c.m_linearVelocity.x-=c.m_invMass*p,c.m_linearVelocity.y-=c.m_invMass*q,c.m_angularVelocity-=c.m_invI*(e*q-f*p),d.m_linearVelocity.x+=d.m_invMass*p,d.m_linearVelocity.y+=d.m_invMass*q,d.m_angularVelocity+=d.m_invI*(h*q-i*p)},g.prototype.SolvePositionConstraints=function(b){void 0===b&&(b=0);var c;if(this.m_frequencyHz>0)return!0;var e=this.m_bodyA,f=this.m_bodyB;c=e.m_xf.R;var g=this.m_localAnchor1.x-e.m_sweep.localCenter.x,h=this.m_localAnchor1.y-e.m_sweep.localCenter.y,i=c.col1.x*g+c.col2.x*h;h=c.col1.y*g+c.col2.y*h,g=i,c=f.m_xf.R;var j=this.m_localAnchor2.x-f.m_sweep.localCenter.x,k=this.m_localAnchor2.y-f.m_sweep.localCenter.y;i=c.col1.x*j+c.col2.x*k,k=c.col1.y*j+c.col2.y*k,j=i;var l=f.m_sweep.c.x+j-e.m_sweep.c.x-g,m=f.m_sweep.c.y+k-e.m_sweep.c.y-h,n=Math.sqrt(l*l+m*m);l/=n,m/=n;var o=n-this.m_length;o=d.Clamp(o,-a.b2_maxLinearCorrection,a.b2_maxLinearCorrection);var p=-this.m_mass*o;this.m_u.Set(l,m);var q=p*this.m_u.x,r=p*this.m_u.y;return e.m_sweep.c.x-=e.m_invMass*q,e.m_sweep.c.y-=e.m_invMass*r,e.m_sweep.a-=e.m_invI*(g*r-h*q),f.m_sweep.c.x+=f.m_invMass*q,f.m_sweep.c.y+=f.m_invMass*r,f.m_sweep.a+=f.m_invI*(j*r-k*q),e.SynchronizeTransform(),f.SynchronizeTransform(),d.Abs(o) 0&&(this.m_angularMass=1/this.m_angularMass),a.warmStarting){this.m_linearImpulse.x*=a.dtRatio,this.m_linearImpulse.y*=a.dtRatio,this.m_angularImpulse*=a.dtRatio;var p=this.m_linearImpulse;e.m_linearVelocity.x-=k*p.x,e.m_linearVelocity.y-=k*p.y,e.m_angularVelocity-=m*(g*p.y-h*p.x+this.m_angularImpulse),f.m_linearVelocity.x+=l*p.x,f.m_linearVelocity.y+=l*p.y,f.m_angularVelocity+=n*(i*p.y-j*p.x+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0},i.prototype.SolveVelocityConstraints=function(a){var b,c=0,f=this.m_bodyA,g=this.m_bodyB,h=f.m_linearVelocity,i=f.m_angularVelocity,j=g.m_linearVelocity,k=g.m_angularVelocity,l=f.m_invMass,m=g.m_invMass,n=f.m_invI,o=g.m_invI;b=f.m_xf.R;var p=this.m_localAnchorA.x-f.m_sweep.localCenter.x,q=this.m_localAnchorA.y-f.m_sweep.localCenter.y;c=b.col1.x*p+b.col2.x*q,q=b.col1.y*p+b.col2.y*q,p=c,b=g.m_xf.R;var r=this.m_localAnchorB.x-g.m_sweep.localCenter.x,s=this.m_localAnchorB.y-g.m_sweep.localCenter.y;c=b.col1.x*r+b.col2.x*s,s=b.col1.y*r+b.col2.y*s,r=c;var t=0,u=k-i,v=-this.m_angularMass*u,w=this.m_angularImpulse;t=a.dt*this.m_maxTorque,this.m_angularImpulse=d.Clamp(this.m_angularImpulse+v,-t,t),v=this.m_angularImpulse-w,i-=n*v,k+=o*v;var x=j.x-k*s-h.x+i*q,y=j.y+k*r-h.y-i*p,z=d.MulMV(this.m_linearMass,new e(-x,-y)),A=this.m_linearImpulse.Copy();this.m_linearImpulse.Add(z),t=a.dt*this.m_maxForce,this.m_linearImpulse.LengthSquared()>t*t&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.Multiply(t)),z=d.SubtractVV(this.m_linearImpulse,A),h.x-=l*z.x,h.y-=l*z.y,i-=n*(p*z.y-q*z.x),j.x+=m*z.x,j.y+=m*z.y,k+=o*(r*z.y-s*z.x),f.m_angularVelocity=i,g.m_angularVelocity=k},i.prototype.SolvePositionConstraints=function(a){return void 0===a&&(a=0),!0},Box2D.inherit(j,Box2D.Dynamics.Joints.b2JointDef),j.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype,j.b2FrictionJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments),this.localAnchorA=new e,this.localAnchorB=new e},j.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this),this.type=n.e_frictionJoint,this.maxForce=0,this.maxTorque=0},j.prototype.Initialize=function(a,b,c){this.bodyA=a,this.bodyB=b,this.localAnchorA.SetV(this.bodyA.GetLocalPoint(c)),this.localAnchorB.SetV(this.bodyB.GetLocalPoint(c))},Box2D.inherit(k,Box2D.Dynamics.Joints.b2Joint),k.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype,k.b2GearJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments),this.m_groundAnchor1=new e,this.m_groundAnchor2=new e,this.m_localAnchor1=new e,this.m_localAnchor2=new e,this.m_J=new m},k.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},k.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},k.prototype.GetReactionForce=function(a){return void 0===a&&(a=0),new e(a*this.m_impulse*this.m_J.linearB.x,a*this.m_impulse*this.m_J.linearB.y)},k.prototype.GetReactionTorque=function(a){void 0===a&&(a=0);var b=this.m_bodyB.m_xf.R,c=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,d=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,e=b.col1.x*c+b.col2.x*d;d=b.col1.y*c+b.col2.y*d,c=e;var f=this.m_impulse*this.m_J.linearB.x,g=this.m_impulse*this.m_J.linearB.y;return a*(this.m_impulse*this.m_J.angularB-c*g+d*f)},k.prototype.GetRatio=function(){return this.m_ratio},k.prototype.SetRatio=function(a){void 0===a&&(a=0),this.m_ratio=a},k.prototype.b2GearJoint=function(a){this.__super.b2Joint.call(this,a);var b=parseInt(a.joint1.m_type),c=parseInt(a.joint2.m_type);this.m_revolute1=null,this.m_prismatic1=null,this.m_revolute2=null,this.m_prismatic2=null;var d=0,e=0;this.m_ground1=a.joint1.GetBodyA(),this.m_bodyA=a.joint1.GetBodyB(),b==n.e_revoluteJoint?(this.m_revolute1=a.joint1 instanceof y?a.joint1:null,this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1),this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2),d=this.m_revolute1.GetJointAngle()):(this.m_prismatic1=a.joint1 instanceof u?a.joint1:null,this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1),this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2),d=this.m_prismatic1.GetJointTranslation()),this.m_ground2=a.joint2.GetBodyA(),this.m_bodyB=a.joint2.GetBodyB(),c==n.e_revoluteJoint?(this.m_revolute2=a.joint2 instanceof y?a.joint2:null,this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1),this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2),e=this.m_revolute2.GetJointAngle()):(this.m_prismatic2=a.joint2 instanceof u?a.joint2:null,this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1),this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2),e=this.m_prismatic2.GetJointTranslation()),this.m_ratio=a.ratio,this.m_constant=d+this.m_ratio*e,this.m_impulse=0},k.prototype.InitVelocityConstraints=function(a){var b,c,d=this.m_ground1,e=this.m_ground2,f=this.m_bodyA,g=this.m_bodyB,h=0,i=0,j=0,k=0,l=0,m=0,n=0;this.m_J.SetZero(),this.m_revolute1?(this.m_J.angularA=-1,n+=f.m_invI):(b=d.m_xf.R,c=this.m_prismatic1.m_localXAxis1,h=b.col1.x*c.x+b.col2.x*c.y,i=b.col1.y*c.x+b.col2.y*c.y,b=f.m_xf.R,j=this.m_localAnchor1.x-f.m_sweep.localCenter.x,k=this.m_localAnchor1.y-f.m_sweep.localCenter.y,m=b.col1.x*j+b.col2.x*k,k=b.col1.y*j+b.col2.y*k,j=m,l=j*i-k*h,this.m_J.linearA.Set(-h,-i),this.m_J.angularA=-l,n+=f.m_invMass+f.m_invI*l*l),this.m_revolute2?(this.m_J.angularB=-this.m_ratio,n+=this.m_ratio*this.m_ratio*g.m_invI):(b=e.m_xf.R,c=this.m_prismatic2.m_localXAxis1,h=b.col1.x*c.x+b.col2.x*c.y,i=b.col1.y*c.x+b.col2.y*c.y,b=g.m_xf.R,j=this.m_localAnchor2.x-g.m_sweep.localCenter.x,k=this.m_localAnchor2.y-g.m_sweep.localCenter.y,m=b.col1.x*j+b.col2.x*k,k=b.col1.y*j+b.col2.y*k,j=m,l=j*i-k*h,this.m_J.linearB.Set(-this.m_ratio*h,-this.m_ratio*i),this.m_J.angularB=-this.m_ratio*l,n+=this.m_ratio*this.m_ratio*(g.m_invMass+g.m_invI*l*l)),this.m_mass=n>0?1/n:0,a.warmStarting?(f.m_linearVelocity.x+=f.m_invMass*this.m_impulse*this.m_J.linearA.x,f.m_linearVelocity.y+=f.m_invMass*this.m_impulse*this.m_J.linearA.y,f.m_angularVelocity+=f.m_invI*this.m_impulse*this.m_J.angularA,g.m_linearVelocity.x+=g.m_invMass*this.m_impulse*this.m_J.linearB.x,g.m_linearVelocity.y+=g.m_invMass*this.m_impulse*this.m_J.linearB.y,g.m_angularVelocity+=g.m_invI*this.m_impulse*this.m_J.angularB):this.m_impulse=0},k.prototype.SolveVelocityConstraints=function(a){var b=this.m_bodyA,c=this.m_bodyB,d=this.m_J.Compute(b.m_linearVelocity,b.m_angularVelocity,c.m_linearVelocity,c.m_angularVelocity),e=-this.m_mass*d;this.m_impulse+=e,b.m_linearVelocity.x+=b.m_invMass*e*this.m_J.linearA.x,b.m_linearVelocity.y+=b.m_invMass*e*this.m_J.linearA.y,b.m_angularVelocity+=b.m_invI*e*this.m_J.angularA,c.m_linearVelocity.x+=c.m_invMass*e*this.m_J.linearB.x,c.m_linearVelocity.y+=c.m_invMass*e*this.m_J.linearB.y,c.m_angularVelocity+=c.m_invI*e*this.m_J.angularB},k.prototype.SolvePositionConstraints=function(b){void 0===b&&(b=0);var c=0,d=this.m_bodyA,e=this.m_bodyB,f=0,g=0;f=this.m_revolute1?this.m_revolute1.GetJointAngle():this.m_prismatic1.GetJointTranslation(),g=this.m_revolute2?this.m_revolute2.GetJointAngle():this.m_prismatic2.GetJointTranslation();var h=this.m_constant-(f+this.m_ratio*g),i=-this.m_mass*h;return d.m_sweep.c.x+=d.m_invMass*i*this.m_J.linearA.x,d.m_sweep.c.y+=d.m_invMass*i*this.m_J.linearA.y,d.m_sweep.a+=d.m_invI*i*this.m_J.angularA,e.m_sweep.c.x+=e.m_invMass*i*this.m_J.linearB.x,e.m_sweep.c.y+=e.m_invMass*i*this.m_J.linearB.y,e.m_sweep.a+=e.m_invI*i*this.m_J.angularB,d.SynchronizeTransform(),e.SynchronizeTransform(),c Number.MIN_VALUE?1/this.m_motorMass:0,this.m_perp.SetV(d.MulMV(h.R,this.m_localYAxis1)),this.m_s1=(m+i)*this.m_perp.y-(o+j)*this.m_perp.x,this.m_s2=k*this.m_perp.y-l*this.m_perp.x;var p=this.m_invMassA,q=this.m_invMassB,r=this.m_invIA,s=this.m_invIB;if(this.m_K.col1.x=p+q+r*this.m_s1*this.m_s1+s*this.m_s2*this.m_s2,this.m_K.col1.y=r*this.m_s1*this.m_a1+s*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=p+q+r*this.m_a1*this.m_a1+s*this.m_a2*this.m_a2,this.m_enableLimit){var t=this.m_axis.x*m+this.m_axis.y*o;d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?this.m_limitState=n.e_equalLimits:t<=this.m_lowerTranslation?this.m_limitState!=n.e_atLowerLimit&&(this.m_limitState=n.e_atLowerLimit,this.m_impulse.y=0):t>=this.m_upperTranslation?this.m_limitState!=n.e_atUpperLimit&&(this.m_limitState=n.e_atUpperLimit,this.m_impulse.y=0):(this.m_limitState=n.e_inactiveLimit,this.m_impulse.y=0)}else this.m_limitState=n.e_inactiveLimit;if(0==this.m_enableMotor&&(this.m_motorImpulse=0),b.warmStarting){this.m_impulse.x*=b.dtRatio,this.m_impulse.y*=b.dtRatio,this.m_motorImpulse*=b.dtRatio;var u=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x,v=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y,w=this.m_impulse.x*this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1,x=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2;e.m_linearVelocity.x-=this.m_invMassA*u,e.m_linearVelocity.y-=this.m_invMassA*v,e.m_angularVelocity-=this.m_invIA*w,f.m_linearVelocity.x+=this.m_invMassB*u,f.m_linearVelocity.y+=this.m_invMassB*v,f.m_angularVelocity+=this.m_invIB*x}else this.m_impulse.SetZero(),this.m_motorImpulse=0},q.prototype.SolveVelocityConstraints=function(a){var b=this.m_bodyA,c=this.m_bodyB,f=b.m_linearVelocity,g=b.m_angularVelocity,h=c.m_linearVelocity,i=c.m_angularVelocity,j=0,k=0,l=0,m=0;if(this.m_enableMotor&&this.m_limitState!=n.e_equalLimits){var o=this.m_axis.x*(h.x-f.x)+this.m_axis.y*(h.y-f.y)+this.m_a2*i-this.m_a1*g,p=this.m_motorMass*(this.m_motorSpeed-o),q=this.m_motorImpulse,r=a.dt*this.m_maxMotorForce;this.m_motorImpulse=d.Clamp(this.m_motorImpulse+p,-r,r),p=this.m_motorImpulse-q,j=p*this.m_axis.x,k=p*this.m_axis.y,l=p*this.m_a1,m=p*this.m_a2,f.x-=this.m_invMassA*j,f.y-=this.m_invMassA*k,g-=this.m_invIA*l,h.x+=this.m_invMassB*j,h.y+=this.m_invMassB*k,i+=this.m_invIB*m}var s=this.m_perp.x*(h.x-f.x)+this.m_perp.y*(h.y-f.y)+this.m_s2*i-this.m_s1*g;if(this.m_enableLimit&&this.m_limitState!=n.e_inactiveLimit){var t=this.m_axis.x*(h.x-f.x)+this.m_axis.y*(h.y-f.y)+this.m_a2*i-this.m_a1*g,u=this.m_impulse.Copy(),v=this.m_K.Solve(new e,-s,-t);this.m_impulse.Add(v),this.m_limitState==n.e_atLowerLimit?this.m_impulse.y=d.Max(this.m_impulse.y,0):this.m_limitState==n.e_atUpperLimit&&(this.m_impulse.y=d.Min(this.m_impulse.y,0));var w=-s-(this.m_impulse.y-u.y)*this.m_K.col2.x,x=0;x=0!=this.m_K.col1.x?w/this.m_K.col1.x+u.x:u.x,this.m_impulse.x=x,v.x=this.m_impulse.x-u.x,v.y=this.m_impulse.y-u.y,j=v.x*this.m_perp.x+v.y*this.m_axis.x,k=v.x*this.m_perp.y+v.y*this.m_axis.y,l=v.x*this.m_s1+v.y*this.m_a1,m=v.x*this.m_s2+v.y*this.m_a2,f.x-=this.m_invMassA*j,f.y-=this.m_invMassA*k,g-=this.m_invIA*l,h.x+=this.m_invMassB*j,h.y+=this.m_invMassB*k,i+=this.m_invIB*m}else{var y=0;y=0!=this.m_K.col1.x?-s/this.m_K.col1.x:0,this.m_impulse.x+=y,j=y*this.m_perp.x,k=y*this.m_perp.y,l=y*this.m_s1,m=y*this.m_s2,f.x-=this.m_invMassA*j,f.y-=this.m_invMassA*k,g-=this.m_invIA*l,h.x+=this.m_invMassB*j,h.y+=this.m_invMassB*k,i+=this.m_invIB*m}b.m_linearVelocity.SetV(f),b.m_angularVelocity=g,c.m_linearVelocity.SetV(h),c.m_angularVelocity=i},q.prototype.SolvePositionConstraints=function(c){void 0===c&&(c=0);var f,g=this.m_bodyA,h=this.m_bodyB,i=g.m_sweep.c,j=g.m_sweep.a,k=h.m_sweep.c,l=h.m_sweep.a,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=!1,u=0,v=b.FromAngle(j),w=b.FromAngle(l);f=v;var x=this.m_localAnchor1.x-this.m_localCenterA.x,y=this.m_localAnchor1.y-this.m_localCenterA.y;m=f.col1.x*x+f.col2.x*y,y=f.col1.y*x+f.col2.y*y,x=m,f=w;var z=this.m_localAnchor2.x-this.m_localCenterB.x,A=this.m_localAnchor2.y-this.m_localCenterB.y;m=f.col1.x*z+f.col2.x*A,A=f.col1.y*z+f.col2.y*A,z=m;var B=k.x+z-i.x-x,C=k.y+A-i.y-y;if(this.m_enableLimit){this.m_axis=d.MulMV(v,this.m_localXAxis1),this.m_a1=(B+x)*this.m_axis.y-(C+y)*this.m_axis.x,this.m_a2=z*this.m_axis.y-A*this.m_axis.x;var D=this.m_axis.x*B+this.m_axis.y*C;d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?(u=d.Clamp(D,-a.b2_maxLinearCorrection,a.b2_maxLinearCorrection),r=d.Abs(D),t=!0):D<=this.m_lowerTranslation?(u=d.Clamp(D-this.m_lowerTranslation+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),r=this.m_lowerTranslation-D,t=!0):D>=this.m_upperTranslation&&(u=d.Clamp(D-this.m_upperTranslation+a.b2_linearSlop,0,a.b2_maxLinearCorrection),r=D-this.m_upperTranslation,t=!0)}this.m_perp=d.MulMV(v,this.m_localYAxis1),this.m_s1=(B+x)*this.m_perp.y-(C+y)*this.m_perp.x,this.m_s2=z*this.m_perp.y-A*this.m_perp.x;var E=new e,F=this.m_perp.x*B+this.m_perp.y*C;if(r=d.Max(r,d.Abs(F)),s=0,t)n=this.m_invMassA,o=this.m_invMassB,p=this.m_invIA,q=this.m_invIB,this.m_K.col1.x=n+o+p*this.m_s1*this.m_s1+q*this.m_s2*this.m_s2,this.m_K.col1.y=p*this.m_s1*this.m_a1+q*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=n+o+p*this.m_a1*this.m_a1+q*this.m_a2*this.m_a2,this.m_K.Solve(E,-F,-u);else{n=this.m_invMassA,o=this.m_invMassB,p=this.m_invIA,q=this.m_invIB;var G=n+o+p*this.m_s1*this.m_s1+q*this.m_s2*this.m_s2,H=0;H=0!=G?-F/G:0,E.x=H,E.y=0}var I=E.x*this.m_perp.x+E.y*this.m_axis.x,J=E.x*this.m_perp.y+E.y*this.m_axis.y,K=E.x*this.m_s1+E.y*this.m_a1,L=E.x*this.m_s2+E.y*this.m_a2;return i.x-=this.m_invMassA*I,i.y-=this.m_invMassA*J,j-=this.m_invIA*K,k.x+=this.m_invMassB*I,k.y+=this.m_invMassB*J,l+=this.m_invIB*L,g.m_sweep.a=j,h.m_sweep.a=l,g.SynchronizeTransform(),h.SynchronizeTransform(),r<=a.b2_linearSlop&&s<=a.b2_angularSlop},Box2D.inherit(r,Box2D.Dynamics.Joints.b2JointDef),r.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype,r.b2LineJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments),this.localAnchorA=new e,this.localAnchorB=new e,this.localAxisA=new e},r.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this),this.type=n.e_lineJoint,this.localAxisA.Set(1,0),this.enableLimit=!1,this.lowerTranslation=0,this.upperTranslation=0,this.enableMotor=!1,this.maxMotorForce=0,this.motorSpeed=0},r.prototype.Initialize=function(a,b,c,d){this.bodyA=a,this.bodyB=b,this.localAnchorA=this.bodyA.GetLocalPoint(c),this.localAnchorB=this.bodyB.GetLocalPoint(c),this.localAxisA=this.bodyA.GetLocalVector(d)},Box2D.inherit(s,Box2D.Dynamics.Joints.b2Joint),s.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype,s.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments),this.K=new b,this.K1=new b,this.K2=new b,this.m_localAnchor=new e,this.m_target=new e,this.m_impulse=new e,this.m_mass=new b,this.m_C=new e},s.prototype.GetAnchorA=function(){return this.m_target},s.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)},s.prototype.GetReactionForce=function(a){return void 0===a&&(a=0),new e(a*this.m_impulse.x,a*this.m_impulse.y)},s.prototype.GetReactionTorque=function(a){return void 0===a&&(a=0),0},s.prototype.GetTarget=function(){return this.m_target},s.prototype.SetTarget=function(a){0==this.m_bodyB.IsAwake()&&this.m_bodyB.SetAwake(!0),this.m_target=a},s.prototype.GetMaxForce=function(){return this.m_maxForce},s.prototype.SetMaxForce=function(a){void 0===a&&(a=0),this.m_maxForce=a},s.prototype.GetFrequency=function(){return this.m_frequencyHz},s.prototype.SetFrequency=function(a){void 0===a&&(a=0),this.m_frequencyHz=a},s.prototype.GetDampingRatio=function(){return this.m_dampingRatio},s.prototype.SetDampingRatio=function(a){void 0===a&&(a=0),this.m_dampingRatio=a},s.prototype.b2MouseJoint=function(a){this.__super.b2Joint.call(this,a),this.m_target.SetV(a.target);var b=this.m_target.x-this.m_bodyB.m_xf.position.x,c=this.m_target.y-this.m_bodyB.m_xf.position.y,d=this.m_bodyB.m_xf.R;this.m_localAnchor.x=b*d.col1.x+c*d.col1.y,this.m_localAnchor.y=b*d.col2.x+c*d.col2.y,this.m_maxForce=a.maxForce,this.m_impulse.SetZero(),this.m_frequencyHz=a.frequencyHz,this.m_dampingRatio=a.dampingRatio,this.m_beta=0,this.m_gamma=0},s.prototype.InitVelocityConstraints=function(a){var b=this.m_bodyB,c=b.GetMass(),d=2*Math.PI*this.m_frequencyHz,e=2*c*this.m_dampingRatio*d,f=c*d*d;this.m_gamma=a.dt*(e+a.dt*f),this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0,this.m_beta=a.dt*f*this.m_gamma;var g;g=b.m_xf.R;var h=this.m_localAnchor.x-b.m_sweep.localCenter.x,i=this.m_localAnchor.y-b.m_sweep.localCenter.y,j=g.col1.x*h+g.col2.x*i;i=g.col1.y*h+g.col2.y*i,h=j;var k=b.m_invMass,l=b.m_invI;this.K1.col1.x=k,this.K1.col2.x=0,this.K1.col1.y=0,this.K1.col2.y=k,this.K2.col1.x=l*i*i,this.K2.col2.x=-l*h*i,this.K2.col1.y=-l*h*i,this.K2.col2.y=l*h*h,this.K.SetM(this.K1),this.K.AddM(this.K2),this.K.col1.x+=this.m_gamma,this.K.col2.y+=this.m_gamma,this.K.GetInverse(this.m_mass),this.m_C.x=b.m_sweep.c.x+h-this.m_target.x,this.m_C.y=b.m_sweep.c.y+i-this.m_target.y,b.m_angularVelocity*=.98,this.m_impulse.x*=a.dtRatio,this.m_impulse.y*=a.dtRatio,b.m_linearVelocity.x+=k*this.m_impulse.x,b.m_linearVelocity.y+=k*this.m_impulse.y,b.m_angularVelocity+=l*(h*this.m_impulse.y-i*this.m_impulse.x)},s.prototype.SolveVelocityConstraints=function(a){var b,c=this.m_bodyB,d=0,e=0;b=c.m_xf.R;var f=this.m_localAnchor.x-c.m_sweep.localCenter.x,g=this.m_localAnchor.y-c.m_sweep.localCenter.y;d=b.col1.x*f+b.col2.x*g,g=b.col1.y*f+b.col2.y*g,f=d;var h=c.m_linearVelocity.x+-c.m_angularVelocity*g,i=c.m_linearVelocity.y+c.m_angularVelocity*f;b=this.m_mass,d=h+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x,e=i+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;var j=-(b.col1.x*d+b.col2.x*e),k=-(b.col1.y*d+b.col2.y*e),l=this.m_impulse.x,m=this.m_impulse.y;this.m_impulse.x+=j,this.m_impulse.y+=k;var n=a.dt*this.m_maxForce;this.m_impulse.LengthSquared()>n*n&&this.m_impulse.Multiply(n/this.m_impulse.Length()),j=this.m_impulse.x-l,k=this.m_impulse.y-m,c.m_linearVelocity.x+=c.m_invMass*j,c.m_linearVelocity.y+=c.m_invMass*k,c.m_angularVelocity+=c.m_invI*(f*k-g*j)},s.prototype.SolvePositionConstraints=function(a){return void 0===a&&(a=0),!0},Box2D.inherit(t,Box2D.Dynamics.Joints.b2JointDef),t.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype,t.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments),this.target=new e},t.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this),this.type=n.e_mouseJoint,this.maxForce=0,this.frequencyHz=5,this.dampingRatio=.7},Box2D.inherit(u,Box2D.Dynamics.Joints.b2Joint),u.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype,u.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments),this.m_localAnchor1=new e,this.m_localAnchor2=new e,this.m_localXAxis1=new e,this.m_localYAxis1=new e,this.m_axis=new e,this.m_perp=new e,this.m_K=new c,this.m_impulse=new f},u.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},u.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},u.prototype.GetReactionForce=function(a){return void 0===a&&(a=0),new e(a*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),a*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))},u.prototype.GetReactionTorque=function(a){return void 0===a&&(a=0),a*this.m_impulse.y},u.prototype.GetJointTranslation=function(){var a=this.m_bodyA,b=this.m_bodyB,c=a.GetWorldPoint(this.m_localAnchor1),d=b.GetWorldPoint(this.m_localAnchor2),e=d.x-c.x,f=d.y-c.y,g=a.GetWorldVector(this.m_localXAxis1);return g.x*e+g.y*f},u.prototype.GetJointSpeed=function(){var a,b=this.m_bodyA,c=this.m_bodyB;a=b.m_xf.R;var d=this.m_localAnchor1.x-b.m_sweep.localCenter.x,e=this.m_localAnchor1.y-b.m_sweep.localCenter.y,f=a.col1.x*d+a.col2.x*e;e=a.col1.y*d+a.col2.y*e,d=f,a=c.m_xf.R;var g=this.m_localAnchor2.x-c.m_sweep.localCenter.x,h=this.m_localAnchor2.y-c.m_sweep.localCenter.y;f=a.col1.x*g+a.col2.x*h,h=a.col1.y*g+a.col2.y*h,g=f;var i=b.m_sweep.c.x+d,j=b.m_sweep.c.y+e,k=c.m_sweep.c.x+g,l=c.m_sweep.c.y+h,m=k-i,n=l-j,o=b.GetWorldVector(this.m_localXAxis1),p=b.m_linearVelocity,q=c.m_linearVelocity,r=b.m_angularVelocity,s=c.m_angularVelocity;return m*(-r*o.y)+n*(r*o.x)+(o.x*(q.x+-s*h-p.x- -r*e)+o.y*(q.y+s*g-p.y-r*d))},u.prototype.IsLimitEnabled=function(){return this.m_enableLimit},u.prototype.EnableLimit=function(a){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=a},u.prototype.GetLowerLimit=function(){return this.m_lowerTranslation},u.prototype.GetUpperLimit=function(){return this.m_upperTranslation},u.prototype.SetLimits=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0),this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=a,this.m_upperTranslation=b},u.prototype.IsMotorEnabled=function(){return this.m_enableMotor},u.prototype.EnableMotor=function(a){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=a},u.prototype.SetMotorSpeed=function(a){void 0===a&&(a=0),this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=a},u.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},u.prototype.SetMaxMotorForce=function(a){void 0===a&&(a=0),this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=a},u.prototype.GetMotorForce=function(){return this.m_motorImpulse},u.prototype.b2PrismaticJoint=function(a){this.__super.b2Joint.call(this,a);this.m_localAnchor1.SetV(a.localAnchorA),this.m_localAnchor2.SetV(a.localAnchorB),this.m_localXAxis1.SetV(a.localAxisA),this.m_localYAxis1.x=-this.m_localXAxis1.y,this.m_localYAxis1.y=this.m_localXAxis1.x,this.m_refAngle=a.referenceAngle,this.m_impulse.SetZero(),this.m_motorMass=0,this.m_motorImpulse=0,this.m_lowerTranslation=a.lowerTranslation,this.m_upperTranslation=a.upperTranslation,this.m_maxMotorForce=a.maxMotorForce,this.m_motorSpeed=a.motorSpeed,this.m_enableLimit=a.enableLimit,this.m_enableMotor=a.enableMotor,this.m_limitState=n.e_inactiveLimit,this.m_axis.SetZero(),this.m_perp.SetZero()},u.prototype.InitVelocityConstraints=function(b){var c,e=this.m_bodyA,f=this.m_bodyB,g=0;this.m_localCenterA.SetV(e.GetLocalCenter()),this.m_localCenterB.SetV(f.GetLocalCenter());var h=e.GetTransform();f.GetTransform();c=e.m_xf.R;var i=this.m_localAnchor1.x-this.m_localCenterA.x,j=this.m_localAnchor1.y-this.m_localCenterA.y;g=c.col1.x*i+c.col2.x*j,j=c.col1.y*i+c.col2.y*j,i=g,c=f.m_xf.R;var k=this.m_localAnchor2.x-this.m_localCenterB.x,l=this.m_localAnchor2.y-this.m_localCenterB.y;g=c.col1.x*k+c.col2.x*l,l=c.col1.y*k+c.col2.y*l,k=g;var m=f.m_sweep.c.x+k-e.m_sweep.c.x-i,o=f.m_sweep.c.y+l-e.m_sweep.c.y-j;this.m_invMassA=e.m_invMass,this.m_invMassB=f.m_invMass,this.m_invIA=e.m_invI,this.m_invIB=f.m_invI,this.m_axis.SetV(d.MulMV(h.R,this.m_localXAxis1)),this.m_a1=(m+i)*this.m_axis.y-(o+j)*this.m_axis.x,this.m_a2=k*this.m_axis.y-l*this.m_axis.x,this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2,this.m_motorMass>Number.MIN_VALUE&&(this.m_motorMass=1/this.m_motorMass),this.m_perp.SetV(d.MulMV(h.R,this.m_localYAxis1)),this.m_s1=(m+i)*this.m_perp.y-(o+j)*this.m_perp.x,this.m_s2=k*this.m_perp.y-l*this.m_perp.x;var p=this.m_invMassA,q=this.m_invMassB,r=this.m_invIA,s=this.m_invIB;if(this.m_K.col1.x=p+q+r*this.m_s1*this.m_s1+s*this.m_s2*this.m_s2,this.m_K.col1.y=r*this.m_s1+s*this.m_s2,this.m_K.col1.z=r*this.m_s1*this.m_a1+s*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=r+s,this.m_K.col2.z=r*this.m_a1+s*this.m_a2,this.m_K.col3.x=this.m_K.col1.z,this.m_K.col3.y=this.m_K.col2.z,this.m_K.col3.z=p+q+r*this.m_a1*this.m_a1+s*this.m_a2*this.m_a2,this.m_enableLimit){var t=this.m_axis.x*m+this.m_axis.y*o;d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?this.m_limitState=n.e_equalLimits:t<=this.m_lowerTranslation?this.m_limitState!=n.e_atLowerLimit&&(this.m_limitState=n.e_atLowerLimit,this.m_impulse.z=0):t>=this.m_upperTranslation?this.m_limitState!=n.e_atUpperLimit&&(this.m_limitState=n.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=n.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=n.e_inactiveLimit;if(0==this.m_enableMotor&&(this.m_motorImpulse=0),b.warmStarting){this.m_impulse.x*=b.dtRatio,this.m_impulse.y*=b.dtRatio,this.m_motorImpulse*=b.dtRatio;var u=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x,v=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y,w=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,x=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;e.m_linearVelocity.x-=this.m_invMassA*u,e.m_linearVelocity.y-=this.m_invMassA*v,e.m_angularVelocity-=this.m_invIA*w,f.m_linearVelocity.x+=this.m_invMassB*u,f.m_linearVelocity.y+=this.m_invMassB*v,f.m_angularVelocity+=this.m_invIB*x}else this.m_impulse.SetZero(),this.m_motorImpulse=0},u.prototype.SolveVelocityConstraints=function(a){var b=this.m_bodyA,c=this.m_bodyB,g=b.m_linearVelocity,h=b.m_angularVelocity,i=c.m_linearVelocity,j=c.m_angularVelocity,k=0,l=0,m=0,o=0;if(this.m_enableMotor&&this.m_limitState!=n.e_equalLimits){var p=this.m_axis.x*(i.x-g.x)+this.m_axis.y*(i.y-g.y)+this.m_a2*j-this.m_a1*h,q=this.m_motorMass*(this.m_motorSpeed-p),r=this.m_motorImpulse,s=a.dt*this.m_maxMotorForce;this.m_motorImpulse=d.Clamp(this.m_motorImpulse+q,-s,s),q=this.m_motorImpulse-r,k=q*this.m_axis.x,l=q*this.m_axis.y,m=q*this.m_a1,o=q*this.m_a2,g.x-=this.m_invMassA*k,g.y-=this.m_invMassA*l,h-=this.m_invIA*m,i.x+=this.m_invMassB*k,i.y+=this.m_invMassB*l,j+=this.m_invIB*o}var t=this.m_perp.x*(i.x-g.x)+this.m_perp.y*(i.y-g.y)+this.m_s2*j-this.m_s1*h,u=j-h;if(this.m_enableLimit&&this.m_limitState!=n.e_inactiveLimit){var v=this.m_axis.x*(i.x-g.x)+this.m_axis.y*(i.y-g.y)+this.m_a2*j-this.m_a1*h,w=this.m_impulse.Copy(),x=this.m_K.Solve33(new f,-t,-u,-v);this.m_impulse.Add(x),this.m_limitState==n.e_atLowerLimit?this.m_impulse.z=d.Max(this.m_impulse.z,0):this.m_limitState==n.e_atUpperLimit&&(this.m_impulse.z=d.Min(this.m_impulse.z,0));var y=-t-(this.m_impulse.z-w.z)*this.m_K.col3.x,z=-u-(this.m_impulse.z-w.z)*this.m_K.col3.y,A=this.m_K.Solve22(new e,y,z);A.x+=w.x,A.y+=w.y,this.m_impulse.x=A.x,this.m_impulse.y=A.y,x.x=this.m_impulse.x-w.x,x.y=this.m_impulse.y-w.y,x.z=this.m_impulse.z-w.z,k=x.x*this.m_perp.x+x.z*this.m_axis.x,l=x.x*this.m_perp.y+x.z*this.m_axis.y,m=x.x*this.m_s1+x.y+x.z*this.m_a1,o=x.x*this.m_s2+x.y+x.z*this.m_a2,g.x-=this.m_invMassA*k,g.y-=this.m_invMassA*l,h-=this.m_invIA*m,i.x+=this.m_invMassB*k,i.y+=this.m_invMassB*l,j+=this.m_invIB*o}else{var B=this.m_K.Solve22(new e,-t,-u);this.m_impulse.x+=B.x,this.m_impulse.y+=B.y,k=B.x*this.m_perp.x,l=B.x*this.m_perp.y,m=B.x*this.m_s1+B.y,o=B.x*this.m_s2+B.y,g.x-=this.m_invMassA*k,g.y-=this.m_invMassA*l,h-=this.m_invIA*m,i.x+=this.m_invMassB*k,i.y+=this.m_invMassB*l,j+=this.m_invIB*o}b.m_linearVelocity.SetV(g),b.m_angularVelocity=h,c.m_linearVelocity.SetV(i),c.m_angularVelocity=j},u.prototype.SolvePositionConstraints=function(c){void 0===c&&(c=0);var g,h=this.m_bodyA,i=this.m_bodyB,j=h.m_sweep.c,k=h.m_sweep.a,l=i.m_sweep.c,m=i.m_sweep.a,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=!1,v=0,w=b.FromAngle(k),x=b.FromAngle(m);g=w;var y=this.m_localAnchor1.x-this.m_localCenterA.x,z=this.m_localAnchor1.y-this.m_localCenterA.y;n=g.col1.x*y+g.col2.x*z,z=g.col1.y*y+g.col2.y*z,y=n,g=x;var A=this.m_localAnchor2.x-this.m_localCenterB.x,B=this.m_localAnchor2.y-this.m_localCenterB.y;n=g.col1.x*A+g.col2.x*B,B=g.col1.y*A+g.col2.y*B,A=n;var C=l.x+A-j.x-y,D=l.y+B-j.y-z;if(this.m_enableLimit){this.m_axis=d.MulMV(w,this.m_localXAxis1),this.m_a1=(C+y)*this.m_axis.y-(D+z)*this.m_axis.x,this.m_a2=A*this.m_axis.y-B*this.m_axis.x;var E=this.m_axis.x*C+this.m_axis.y*D;d.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*a.b2_linearSlop?(v=d.Clamp(E,-a.b2_maxLinearCorrection,a.b2_maxLinearCorrection),s=d.Abs(E),u=!0):E<=this.m_lowerTranslation?(v=d.Clamp(E-this.m_lowerTranslation+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),s=this.m_lowerTranslation-E,u=!0):E>=this.m_upperTranslation&&(v=d.Clamp(E-this.m_upperTranslation+a.b2_linearSlop,0,a.b2_maxLinearCorrection),s=E-this.m_upperTranslation,u=!0)}this.m_perp=d.MulMV(w,this.m_localYAxis1),this.m_s1=(C+y)*this.m_perp.y-(D+z)*this.m_perp.x,this.m_s2=A*this.m_perp.y-B*this.m_perp.x;var F=new f,G=this.m_perp.x*C+this.m_perp.y*D,H=m-k-this.m_refAngle;if(s=d.Max(s,d.Abs(G)),t=d.Abs(H),u)o=this.m_invMassA,p=this.m_invMassB,q=this.m_invIA,r=this.m_invIB,this.m_K.col1.x=o+p+q*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2,this.m_K.col1.y=q*this.m_s1+r*this.m_s2,this.m_K.col1.z=q*this.m_s1*this.m_a1+r*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=q+r,this.m_K.col2.z=q*this.m_a1+r*this.m_a2,this.m_K.col3.x=this.m_K.col1.z,this.m_K.col3.y=this.m_K.col2.z,this.m_K.col3.z=o+p+q*this.m_a1*this.m_a1+r*this.m_a2*this.m_a2,this.m_K.Solve33(F,-G,-H,-v);else{o=this.m_invMassA,p=this.m_invMassB,q=this.m_invIA,r=this.m_invIB;var I=o+p+q*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2,J=q*this.m_s1+r*this.m_s2,K=q+r;this.m_K.col1.Set(I,J,0),this.m_K.col2.Set(J,K,0);var L=this.m_K.Solve22(new e,-G,-H);F.x=L.x,F.y=L.y,F.z=0}var M=F.x*this.m_perp.x+F.z*this.m_axis.x,N=F.x*this.m_perp.y+F.z*this.m_axis.y,O=F.x*this.m_s1+F.y+F.z*this.m_a1,P=F.x*this.m_s2+F.y+F.z*this.m_a2;return j.x-=this.m_invMassA*M,j.y-=this.m_invMassA*N,k-=this.m_invIA*O,l.x+=this.m_invMassB*M,l.y+=this.m_invMassB*N,m+=this.m_invIB*P,h.m_sweep.a=k,i.m_sweep.a=m,h.SynchronizeTransform(),i.SynchronizeTransform(),s<=a.b2_linearSlop&&t<=a.b2_angularSlop},Box2D.inherit(v,Box2D.Dynamics.Joints.b2JointDef),v.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype,v.b2PrismaticJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments),this.localAnchorA=new e,this.localAnchorB=new e,this.localAxisA=new e},v.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this),this.type=n.e_prismaticJoint,this.localAxisA.Set(1,0),this.referenceAngle=0,this.enableLimit=!1,this.lowerTranslation=0,this.upperTranslation=0,this.enableMotor=!1,this.maxMotorForce=0,this.motorSpeed=0},v.prototype.Initialize=function(a,b,c,d){this.bodyA=a,this.bodyB=b,this.localAnchorA=this.bodyA.GetLocalPoint(c),this.localAnchorB=this.bodyB.GetLocalPoint(c),this.localAxisA=this.bodyA.GetLocalVector(d),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},Box2D.inherit(w,Box2D.Dynamics.Joints.b2Joint),w.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype,w.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments),this.m_groundAnchor1=new e,this.m_groundAnchor2=new e,this.m_localAnchor1=new e,this.m_localAnchor2=new e,this.m_u1=new e,this.m_u2=new e},w.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},w.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},w.prototype.GetReactionForce=function(a){return void 0===a&&(a=0),new e(a*this.m_impulse*this.m_u2.x,a*this.m_impulse*this.m_u2.y)},w.prototype.GetReactionTorque=function(a){return void 0===a&&(a=0),0},w.prototype.GetGroundAnchorA=function(){var a=this.m_ground.m_xf.position.Copy();return a.Add(this.m_groundAnchor1),a},w.prototype.GetGroundAnchorB=function(){var a=this.m_ground.m_xf.position.Copy();return a.Add(this.m_groundAnchor2),a},w.prototype.GetLength1=function(){var a=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),b=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,c=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,d=a.x-b,e=a.y-c;return Math.sqrt(d*d+e*e)},w.prototype.GetLength2=function(){var a=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),b=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,c=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,d=a.x-b,e=a.y-c;return Math.sqrt(d*d+e*e)},w.prototype.GetRatio=function(){return this.m_ratio},w.prototype.b2PulleyJoint=function(a){this.__super.b2Joint.call(this,a);this.m_ground=this.m_bodyA.m_world.m_groundBody,this.m_groundAnchor1.x=a.groundAnchorA.x-this.m_ground.m_xf.position.x,this.m_groundAnchor1.y=a.groundAnchorA.y-this.m_ground.m_xf.position.y,this.m_groundAnchor2.x=a.groundAnchorB.x-this.m_ground.m_xf.position.x,this.m_groundAnchor2.y=a.groundAnchorB.y-this.m_ground.m_xf.position.y,this.m_localAnchor1.SetV(a.localAnchorA),this.m_localAnchor2.SetV(a.localAnchorB),this.m_ratio=a.ratio,this.m_constant=a.lengthA+this.m_ratio*a.lengthB,this.m_maxLength1=d.Min(a.maxLengthA,this.m_constant-this.m_ratio*w.b2_minPulleyLength),this.m_maxLength2=d.Min(a.maxLengthB,(this.m_constant-w.b2_minPulleyLength)/this.m_ratio),this.m_impulse=0,this.m_limitImpulse1=0,this.m_limitImpulse2=0},w.prototype.InitVelocityConstraints=function(b){var c,d=this.m_bodyA,e=this.m_bodyB;c=d.m_xf.R;var f=this.m_localAnchor1.x-d.m_sweep.localCenter.x,g=this.m_localAnchor1.y-d.m_sweep.localCenter.y,h=c.col1.x*f+c.col2.x*g;g=c.col1.y*f+c.col2.y*g,f=h,c=e.m_xf.R;var i=this.m_localAnchor2.x-e.m_sweep.localCenter.x,j=this.m_localAnchor2.y-e.m_sweep.localCenter.y;h=c.col1.x*i+c.col2.x*j,j=c.col1.y*i+c.col2.y*j,i=h;var k=d.m_sweep.c.x+f,l=d.m_sweep.c.y+g,m=e.m_sweep.c.x+i,o=e.m_sweep.c.y+j,p=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,q=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,r=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,s=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(k-p,l-q),this.m_u2.Set(m-r,o-s);var t=this.m_u1.Length(),u=this.m_u2.Length();t>a.b2_linearSlop?this.m_u1.Multiply(1/t):this.m_u1.SetZero(),u>a.b2_linearSlop?this.m_u2.Multiply(1/u):this.m_u2.SetZero(),this.m_constant-t-this.m_ratio*u>0?(this.m_state=n.e_inactiveLimit,this.m_impulse=0):this.m_state=n.e_atUpperLimit,t a.b2_linearSlop?this.m_u1.Multiply(1/t):this.m_u1.SetZero(),u>a.b2_linearSlop?this.m_u2.Multiply(1/u):this.m_u2.SetZero(),v=this.m_constant-t-this.m_ratio*u,y=d.Max(y,-v),v=d.Clamp(v+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),w=-this.m_pulleyMass*v,p=-w*this.m_u1.x,q=-w*this.m_u1.y,r=-this.m_ratio*w*this.m_u2.x,s=-this.m_ratio*w*this.m_u2.y,e.m_sweep.c.x+=e.m_invMass*p,e.m_sweep.c.y+=e.m_invMass*q,e.m_sweep.a+=e.m_invI*(k*q-l*p),f.m_sweep.c.x+=f.m_invMass*r,f.m_sweep.c.y+=f.m_invMass*s,f.m_sweep.a+=f.m_invI*(m*s-o*r),e.SynchronizeTransform(),f.SynchronizeTransform()),this.m_limitState1==n.e_atUpperLimit&&(c=e.m_xf.R,k=this.m_localAnchor1.x-e.m_sweep.localCenter.x,l=this.m_localAnchor1.y-e.m_sweep.localCenter.y,x=c.col1.x*k+c.col2.x*l,l=c.col1.y*k+c.col2.y*l,k=x,p=e.m_sweep.c.x+k,q=e.m_sweep.c.y+l,this.m_u1.Set(p-g,q-h),t=this.m_u1.Length(), t>a.b2_linearSlop?(this.m_u1.x*=1/t,this.m_u1.y*=1/t):this.m_u1.SetZero(),v=this.m_maxLength1-t,y=d.Max(y,-v),v=d.Clamp(v+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),w=-this.m_limitMass1*v,p=-w*this.m_u1.x,q=-w*this.m_u1.y,e.m_sweep.c.x+=e.m_invMass*p,e.m_sweep.c.y+=e.m_invMass*q,e.m_sweep.a+=e.m_invI*(k*q-l*p),e.SynchronizeTransform()),this.m_limitState2==n.e_atUpperLimit&&(c=f.m_xf.R,m=this.m_localAnchor2.x-f.m_sweep.localCenter.x,o=this.m_localAnchor2.y-f.m_sweep.localCenter.y,x=c.col1.x*m+c.col2.x*o,o=c.col1.y*m+c.col2.y*o,m=x,r=f.m_sweep.c.x+m,s=f.m_sweep.c.y+o,this.m_u2.Set(r-i,s-j),u=this.m_u2.Length(),u>a.b2_linearSlop?(this.m_u2.x*=1/u,this.m_u2.y*=1/u):this.m_u2.SetZero(),v=this.m_maxLength2-u,y=d.Max(y,-v),v=d.Clamp(v+a.b2_linearSlop,-a.b2_maxLinearCorrection,0),w=-this.m_limitMass2*v,r=-w*this.m_u2.x,s=-w*this.m_u2.y,f.m_sweep.c.x+=f.m_invMass*r,f.m_sweep.c.y+=f.m_invMass*s,f.m_sweep.a+=f.m_invI*(m*s-o*r),f.SynchronizeTransform()),y =this.m_upperAngle?(this.m_limitState!=n.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=n.e_atUpperLimit):(this.m_limitState=n.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=n.e_inactiveLimit;if(b.warmStarting){this.m_impulse.x*=b.dtRatio,this.m_impulse.y*=b.dtRatio,this.m_motorImpulse*=b.dtRatio;var r=this.m_impulse.x,s=this.m_impulse.y;e.m_linearVelocity.x-=l*r,e.m_linearVelocity.y-=l*s,e.m_angularVelocity-=o*(h*s-i*r+this.m_motorImpulse+this.m_impulse.z),f.m_linearVelocity.x+=m*r,f.m_linearVelocity.y+=m*s,f.m_angularVelocity+=p*(j*s-k*r+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0},y.prototype.SolveVelocityConstraints=function(a){var b,c=this.m_bodyA,e=this.m_bodyB,f=0,g=0,h=0,i=0,j=0,k=c.m_linearVelocity,l=c.m_angularVelocity,m=e.m_linearVelocity,o=e.m_angularVelocity,p=c.m_invMass,q=e.m_invMass,r=c.m_invI,s=e.m_invI;if(this.m_enableMotor&&this.m_limitState!=n.e_equalLimits){var t=o-l-this.m_motorSpeed,u=this.m_motorMass*-t,v=this.m_motorImpulse,w=a.dt*this.m_maxMotorTorque;this.m_motorImpulse=d.Clamp(this.m_motorImpulse+u,-w,w),u=this.m_motorImpulse-v,l-=r*u,o+=s*u}if(this.m_enableLimit&&this.m_limitState!=n.e_inactiveLimit){b=c.m_xf.R,g=this.m_localAnchor1.x-c.m_sweep.localCenter.x,h=this.m_localAnchor1.y-c.m_sweep.localCenter.y,f=b.col1.x*g+b.col2.x*h,h=b.col1.y*g+b.col2.y*h,g=f,b=e.m_xf.R,i=this.m_localAnchor2.x-e.m_sweep.localCenter.x,j=this.m_localAnchor2.y-e.m_sweep.localCenter.y,f=b.col1.x*i+b.col2.x*j,j=b.col1.y*i+b.col2.y*j,i=f;var x=m.x+-o*j-k.x- -l*h,y=m.y+o*i-k.y-l*g,z=o-l;this.m_mass.Solve33(this.impulse3,-x,-y,-z),this.m_limitState==n.e_equalLimits?this.m_impulse.Add(this.impulse3):this.m_limitState==n.e_atLowerLimit?this.m_impulse.z+this.impulse3.z<0&&(this.m_mass.Solve22(this.reduced,-x,-y),this.impulse3.x=this.reduced.x,this.impulse3.y=this.reduced.y,this.impulse3.z=-this.m_impulse.z,this.m_impulse.x+=this.reduced.x,this.m_impulse.y+=this.reduced.y,this.m_impulse.z=0):this.m_limitState==n.e_atUpperLimit&&this.m_impulse.z+this.impulse3.z>0&&(this.m_mass.Solve22(this.reduced,-x,-y),this.impulse3.x=this.reduced.x,this.impulse3.y=this.reduced.y,this.impulse3.z=-this.m_impulse.z,this.m_impulse.x+=this.reduced.x,this.m_impulse.y+=this.reduced.y,this.m_impulse.z=0),k.x-=p*this.impulse3.x,k.y-=p*this.impulse3.y,l-=r*(g*this.impulse3.y-h*this.impulse3.x+this.impulse3.z),m.x+=q*this.impulse3.x,m.y+=q*this.impulse3.y,o+=s*(i*this.impulse3.y-j*this.impulse3.x+this.impulse3.z)}else{b=c.m_xf.R,g=this.m_localAnchor1.x-c.m_sweep.localCenter.x,h=this.m_localAnchor1.y-c.m_sweep.localCenter.y,f=b.col1.x*g+b.col2.x*h,h=b.col1.y*g+b.col2.y*h,g=f,b=e.m_xf.R,i=this.m_localAnchor2.x-e.m_sweep.localCenter.x,j=this.m_localAnchor2.y-e.m_sweep.localCenter.y,f=b.col1.x*i+b.col2.x*j,j=b.col1.y*i+b.col2.y*j,i=f;var A=m.x+-o*j-k.x- -l*h,B=m.y+o*i-k.y-l*g;this.m_mass.Solve22(this.impulse2,-A,-B),this.m_impulse.x+=this.impulse2.x,this.m_impulse.y+=this.impulse2.y,k.x-=p*this.impulse2.x,k.y-=p*this.impulse2.y,l-=r*(g*this.impulse2.y-h*this.impulse2.x),m.x+=q*this.impulse2.x,m.y+=q*this.impulse2.y,o+=s*(i*this.impulse2.y-j*this.impulse2.x)}c.m_linearVelocity.SetV(k),c.m_angularVelocity=l,e.m_linearVelocity.SetV(m),e.m_angularVelocity=o},y.prototype.SolvePositionConstraints=function(b){void 0===b&&(b=0);var c,e=0,f=this.m_bodyA,g=this.m_bodyB,h=0,i=0,j=0,k=0,l=0;if(this.m_enableLimit&&this.m_limitState!=n.e_inactiveLimit){var m=g.m_sweep.a-f.m_sweep.a-this.m_referenceAngle,o=0;this.m_limitState==n.e_equalLimits?(e=d.Clamp(m-this.m_lowerAngle,-a.b2_maxAngularCorrection,a.b2_maxAngularCorrection),o=-this.m_motorMass*e,h=d.Abs(e)):this.m_limitState==n.e_atLowerLimit?(e=m-this.m_lowerAngle,h=-e,e=d.Clamp(e+a.b2_angularSlop,-a.b2_maxAngularCorrection,0),o=-this.m_motorMass*e):this.m_limitState==n.e_atUpperLimit&&(e=m-this.m_upperAngle,h=e,e=d.Clamp(e-a.b2_angularSlop,0,a.b2_maxAngularCorrection),o=-this.m_motorMass*e),f.m_sweep.a-=f.m_invI*o,g.m_sweep.a+=g.m_invI*o,f.SynchronizeTransform(),g.SynchronizeTransform()}c=f.m_xf.R;var p=this.m_localAnchor1.x-f.m_sweep.localCenter.x,q=this.m_localAnchor1.y-f.m_sweep.localCenter.y;j=c.col1.x*p+c.col2.x*q,q=c.col1.y*p+c.col2.y*q,p=j,c=g.m_xf.R;var r=this.m_localAnchor2.x-g.m_sweep.localCenter.x,s=this.m_localAnchor2.y-g.m_sweep.localCenter.y;j=c.col1.x*r+c.col2.x*s,s=c.col1.y*r+c.col2.y*s,r=j;var t=g.m_sweep.c.x+r-f.m_sweep.c.x-p,u=g.m_sweep.c.y+s-f.m_sweep.c.y-q,v=t*t+u*u,w=Math.sqrt(v);i=w;var x=f.m_invMass,z=g.m_invMass,A=f.m_invI,B=g.m_invI,C=10*a.b2_linearSlop;if(v>C*C){var D=x+z,E=1/D;k=E*-t,l=E*-u;var F=.5;f.m_sweep.c.x-=F*x*k,f.m_sweep.c.y-=F*x*l,g.m_sweep.c.x+=F*z*k,g.m_sweep.c.y+=F*z*l,t=g.m_sweep.c.x+r-f.m_sweep.c.x-p,u=g.m_sweep.c.y+s-f.m_sweep.c.y-q}return this.K1.col1.x=x+z,this.K1.col2.x=0,this.K1.col1.y=0,this.K1.col2.y=x+z,this.K2.col1.x=A*q*q,this.K2.col2.x=-A*p*q,this.K2.col1.y=-A*p*q,this.K2.col2.y=A*p*p,this.K3.col1.x=B*s*s,this.K3.col2.x=-B*r*s,this.K3.col1.y=-B*r*s,this.K3.col2.y=B*r*r,this.K.SetM(this.K1),this.K.AddM(this.K2),this.K.AddM(this.K3),this.K.Solve(y.tImpulse,-t,-u),k=y.tImpulse.x,l=y.tImpulse.y,f.m_sweep.c.x-=f.m_invMass*k,f.m_sweep.c.y-=f.m_invMass*l,f.m_sweep.a-=f.m_invI*(p*l-q*k),g.m_sweep.c.x+=g.m_invMass*k,g.m_sweep.c.y+=g.m_invMass*l,g.m_sweep.a+=g.m_invI*(r*l-s*k),f.SynchronizeTransform(),g.SynchronizeTransform(),i<=a.b2_linearSlop&&h<=a.b2_angularSlop},Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new e}),Box2D.inherit(z,Box2D.Dynamics.Joints.b2JointDef),z.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype,z.b2RevoluteJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments),this.localAnchorA=new e,this.localAnchorB=new e},z.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this),this.type=n.e_revoluteJoint,this.localAnchorA.Set(0,0),this.localAnchorB.Set(0,0),this.referenceAngle=0,this.lowerAngle=0,this.upperAngle=0,this.maxMotorTorque=0,this.motorSpeed=0,this.enableLimit=!1,this.enableMotor=!1},z.prototype.Initialize=function(a,b,c){this.bodyA=a,this.bodyB=b,this.localAnchorA=this.bodyA.GetLocalPoint(c),this.localAnchorB=this.bodyB.GetLocalPoint(c),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},Box2D.inherit(A,Box2D.Dynamics.Joints.b2Joint),A.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype,A.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments),this.m_localAnchorA=new e,this.m_localAnchorB=new e,this.m_impulse=new f,this.m_mass=new c},A.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)},A.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)},A.prototype.GetReactionForce=function(a){return void 0===a&&(a=0),new e(a*this.m_impulse.x,a*this.m_impulse.y)},A.prototype.GetReactionTorque=function(a){return void 0===a&&(a=0),a*this.m_impulse.z},A.prototype.b2WeldJoint=function(a){this.__super.b2Joint.call(this,a),this.m_localAnchorA.SetV(a.localAnchorA),this.m_localAnchorB.SetV(a.localAnchorB),this.m_referenceAngle=a.referenceAngle,this.m_impulse.SetZero(),this.m_mass=new c},A.prototype.InitVelocityConstraints=function(a){var b,c=0,d=this.m_bodyA,e=this.m_bodyB;b=d.m_xf.R;var f=this.m_localAnchorA.x-d.m_sweep.localCenter.x,g=this.m_localAnchorA.y-d.m_sweep.localCenter.y;c=b.col1.x*f+b.col2.x*g,g=b.col1.y*f+b.col2.y*g,f=c,b=e.m_xf.R;var h=this.m_localAnchorB.x-e.m_sweep.localCenter.x,i=this.m_localAnchorB.y-e.m_sweep.localCenter.y;c=b.col1.x*h+b.col2.x*i,i=b.col1.y*h+b.col2.y*i,h=c;var j=d.m_invMass,k=e.m_invMass,l=d.m_invI,m=e.m_invI;this.m_mass.col1.x=j+k+g*g*l+i*i*m,this.m_mass.col2.x=-g*f*l-i*h*m,this.m_mass.col3.x=-g*l-i*m,this.m_mass.col1.y=this.m_mass.col2.x,this.m_mass.col2.y=j+k+f*f*l+h*h*m,this.m_mass.col3.y=f*l+h*m,this.m_mass.col1.z=this.m_mass.col3.x,this.m_mass.col2.z=this.m_mass.col3.y,this.m_mass.col3.z=l+m,a.warmStarting?(this.m_impulse.x*=a.dtRatio,this.m_impulse.y*=a.dtRatio,this.m_impulse.z*=a.dtRatio,d.m_linearVelocity.x-=j*this.m_impulse.x,d.m_linearVelocity.y-=j*this.m_impulse.y,d.m_angularVelocity-=l*(f*this.m_impulse.y-g*this.m_impulse.x+this.m_impulse.z),e.m_linearVelocity.x+=k*this.m_impulse.x,e.m_linearVelocity.y+=k*this.m_impulse.y,e.m_angularVelocity+=m*(h*this.m_impulse.y-i*this.m_impulse.x+this.m_impulse.z)):this.m_impulse.SetZero()},A.prototype.SolveVelocityConstraints=function(a){var b,c=0,d=this.m_bodyA,e=this.m_bodyB,g=d.m_linearVelocity,h=d.m_angularVelocity,i=e.m_linearVelocity,j=e.m_angularVelocity,k=d.m_invMass,l=e.m_invMass,m=d.m_invI,n=e.m_invI;b=d.m_xf.R;var o=this.m_localAnchorA.x-d.m_sweep.localCenter.x,p=this.m_localAnchorA.y-d.m_sweep.localCenter.y;c=b.col1.x*o+b.col2.x*p,p=b.col1.y*o+b.col2.y*p,o=c,b=e.m_xf.R;var q=this.m_localAnchorB.x-e.m_sweep.localCenter.x,r=this.m_localAnchorB.y-e.m_sweep.localCenter.y;c=b.col1.x*q+b.col2.x*r,r=b.col1.y*q+b.col2.y*r,q=c;var s=i.x-j*r-g.x+h*p,t=i.y+j*q-g.y-h*o,u=j-h,v=new f;this.m_mass.Solve33(v,-s,-t,-u),this.m_impulse.Add(v),g.x-=k*v.x,g.y-=k*v.y,h-=m*(o*v.y-p*v.x+v.z),i.x+=l*v.x,i.y+=l*v.y,j+=n*(q*v.y-r*v.x+v.z),d.m_angularVelocity=h,e.m_angularVelocity=j},A.prototype.SolvePositionConstraints=function(b){void 0===b&&(b=0);var c,e=0,g=this.m_bodyA,h=this.m_bodyB;c=g.m_xf.R;var i=this.m_localAnchorA.x-g.m_sweep.localCenter.x,j=this.m_localAnchorA.y-g.m_sweep.localCenter.y;e=c.col1.x*i+c.col2.x*j,j=c.col1.y*i+c.col2.y*j,i=e,c=h.m_xf.R;var k=this.m_localAnchorB.x-h.m_sweep.localCenter.x,l=this.m_localAnchorB.y-h.m_sweep.localCenter.y;e=c.col1.x*k+c.col2.x*l,l=c.col1.y*k+c.col2.y*l,k=e;var m=g.m_invMass,n=h.m_invMass,o=g.m_invI,p=h.m_invI,q=h.m_sweep.c.x+k-g.m_sweep.c.x-i,r=h.m_sweep.c.y+l-g.m_sweep.c.y-j,s=h.m_sweep.a-g.m_sweep.a-this.m_referenceAngle,t=10*a.b2_linearSlop,u=Math.sqrt(q*q+r*r),v=d.Abs(s);u>t&&(o*=1,p*=1),this.m_mass.col1.x=m+n+j*j*o+l*l*p,this.m_mass.col2.x=-j*i*o-l*k*p,this.m_mass.col3.x=-j*o-l*p,this.m_mass.col1.y=this.m_mass.col2.x,this.m_mass.col2.y=m+n+i*i*o+k*k*p,this.m_mass.col3.y=i*o+k*p,this.m_mass.col1.z=this.m_mass.col3.x,this.m_mass.col2.z=this.m_mass.col3.y,this.m_mass.col3.z=o+p;var w=new f;return this.m_mass.Solve33(w,-q,-r,-s),g.m_sweep.c.x-=m*w.x,g.m_sweep.c.y-=m*w.y,g.m_sweep.a-=o*(i*w.y-j*w.x+w.z),h.m_sweep.c.x+=n*w.x,h.m_sweep.c.y+=n*w.y,h.m_sweep.a+=p*(k*w.y-l*w.x+w.z),g.SynchronizeTransform(),h.SynchronizeTransform(),u<=a.b2_linearSlop&&v<=a.b2_angularSlop},Box2D.inherit(B,Box2D.Dynamics.Joints.b2JointDef),B.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype,B.b2WeldJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments),this.localAnchorA=new e,this.localAnchorB=new e},B.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this),this.type=n.e_weldJoint,this.referenceAngle=0},B.prototype.Initialize=function(a,b,c){this.bodyA=a,this.bodyB=b,this.localAnchorA.SetV(this.bodyA.GetLocalPoint(c)),this.localAnchorB.SetV(this.bodyB.GetLocalPoint(c)),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}}(),function(){var a=Box2D.Dynamics.b2DebugDraw;a.b2DebugDraw=function(){this.m_drawScale=1,this.m_lineThickness=1,this.m_alpha=1,this.m_fillAlpha=1,this.m_xformScale=1;var a=this;this.m_sprite={graphics:{clear:function(){a.m_ctx.clearRect(0,0,a.m_ctx.canvas.width,a.m_ctx.canvas.height)}}}},a.prototype._color=function(a,b){return"rgba("+((16711680&a)>>16)+","+((65280&a)>>8)+","+(255&a)+","+b+")"},a.prototype.b2DebugDraw=function(){this.m_drawFlags=0},a.prototype.SetFlags=function(a){void 0===a&&(a=0),this.m_drawFlags=a},a.prototype.GetFlags=function(){return this.m_drawFlags},a.prototype.AppendFlags=function(a){void 0===a&&(a=0),this.m_drawFlags|=a},a.prototype.ClearFlags=function(a){void 0===a&&(a=0),this.m_drawFlags&=~a},a.prototype.SetSprite=function(a){this.m_ctx=a},a.prototype.GetSprite=function(){return this.m_ctx},a.prototype.SetDrawScale=function(a){void 0===a&&(a=0),this.m_drawScale=a},a.prototype.GetDrawScale=function(){return this.m_drawScale},a.prototype.SetLineThickness=function(a){void 0===a&&(a=0),this.m_lineThickness=a,this.m_ctx.strokeWidth=a},a.prototype.GetLineThickness=function(){return this.m_lineThickness},a.prototype.SetAlpha=function(a){void 0===a&&(a=0),this.m_alpha=a},a.prototype.GetAlpha=function(){return this.m_alpha},a.prototype.SetFillAlpha=function(a){void 0===a&&(a=0),this.m_fillAlpha=a},a.prototype.GetFillAlpha=function(){return this.m_fillAlpha},a.prototype.SetXFormScale=function(a){void 0===a&&(a=0),this.m_xformScale=a},a.prototype.GetXFormScale=function(){return this.m_xformScale},a.prototype.DrawPolygon=function(a,b,c){if(b){var d=this.m_ctx,e=this.m_drawScale;d.beginPath(),d.strokeStyle=this._color(c.color,this.m_alpha),d.moveTo(a[0].x*e,a[0].y*e);for(var f=1;f=0?Stratiscape.Global.layerNextZIndex<=d.zIndex&&(Stratiscape.Global.layerNextZIndex=d.zIndex+1):d.zIndex=Stratiscape.Global.layerNextZIndex++;var e="lyr_"+d.name+d.zIndex,f="";d.backgroundColor&&(f="background-color:"+d.backgroundColor+";"),b+=''}this.container.innerHTML=b;for(var c in a.layers){var d=a.layers[c],e="lyr_"+d.name+d.zIndex,g=null;if(d.mouseHitId){var h=this;g=document.getElementById(d.mouseHitId),d.clickCallback&&(g.layerConfig=d,Stratiscape.Global.onEvent(g,"click",function(a){var b=h.getScaledCursorPosition(a);(a.srcElement||a.target).layerConfig.clickCallback(b)})),d.dblclickCallback&&(g.layerConfig=d,Stratiscape.Global.onEvent(g,"dblclick",function(a){var b=h.getScaledCursorPosition(a);(a.srcElement||a.target).layerConfig.dblclickCallback(b)}))}var i=new Stratiscape.Layer(e,d.name,d.x,d.y,d.width,d.height,d.zIndex,g);this.layers.push(i),this.layersByName[i.name]=i}},Stratiscape.prototype.getScaledCursorPosition=function(a){var b=Stratiscape.Global.getCursorPosition(a);return this.inverseScaleRatio&&(b.x*=this.inverseScaleRatio,b.y*=this.inverseScaleRatio),b},Stratiscape.Global={layerNextZIndex:1},Stratiscape.Global.getCursorPosition=function(a){var b={x:null,y:null};void 0!=a.pageX&&void 0!=a.pageY?(b.x=a.pageX,b.y=a.pageY):(b.x=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,b.y=a.clientY+document.body.scrollTop+document.documentElement.scrollTop);var c=a.srcElement||a.target;do{b.x-=c.offsetLeft||0,b.y-=c.offsetTop||0,c=c.offsetParent}while(c);return b},Stratiscape.Global.onEvent=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},Stratiscape.Global.scaleElement=function(a,b,c){a&&(a.style.width=(a.width||a.clientWidth)*b.widthScale+"px",a.style.height=(a.height||a.clientHeight)*b.heightScale+"px",c||(0!=a.offsetLeft&&(a.style.left=a.offsetLeft*b.widthScale+"px"),0!=a.offsetTop&&(a.style.top=a.offsetTop*b.heightScale+"px")))},Stratiscape.prototype.scaleLayers=function(a){var b={widthScale:1,heightScale:1},c=window.innerWidth,d=window.innerHeight,e=c/d,f=a.mainWidth/a.mainHeight,g=1,h=a.ratioTolerance||.02;if(e f+h){var i=c/(a.mainWidth+(a.paddingWidth||0)),j=d/(a.mainHeight+(a.paddingHeight||0)),g=Math.min(i,j);b={widthScale:g,heightScale:g};for(var k in this.layers){var l=document.StratiscapeDraw.layers[k];Stratiscape.Global.scaleElement(l.canvas,b),l.mouseHitElm&&Stratiscape.Global.scaleElement(l.mouseHitElm,b)}if(a.additionalElementIds)for(var k in a.additionalElementIds)Stratiscape.Global.scaleElement(document.getElementById(a.additionalElementIds[k]),b,!0);this.inverseScaleRatio=1/g}return b},Stratiscape.prototype.getLayer=function(a){return this.layersByName[a]?this.layersByName[a]:null},Stratiscape.prototype.draw=function(){for(var a in this.layers)this.layers[a].needsDisplay&&this.layers[a].draw()},Stratiscape.prototype.layerSortFunction=function(a,b){return a.zIndex>b.zIndex?1:a.zIndex =a&&this.y+this.height>=b},Stratiscape.Layer.prototype.addChild=function(a){a.layer=this,this.children.push(a),this.needsDisplay=!0},Stratiscape.Layer.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!=b&&(a.layer=null,this.children.splice(b,1),this.needsDisplay=!0)},Stratiscape.Layer.prototype.clear=function(){for(var a in this.children)this.children[a].layer=null;this.children=[],this.needsDisplay=!0},Stratiscape.DrawnObject=Class.extend({init:function(){this.x=0,this.y=0,this.layer=null},draw:function(a){},isInBounds:function(a,b){return!1}}),SfxInterface=function(a){this.Volume=1,this.muted=!1,this.fileNames=a,this.audioObjects={};for(var b in a){this.audioObjects[a[b]]=[];for(var c=0;c<3;c++)this.audioObjects[a[b]].push(this.createAudioObject(a[b]))}},SfxInterface.prototype.toggleMute=function(){this.muted=!this.muted;for(var a in this.audioObjects)for(var b=0;b this.config.maxSmallDesktopWideWidth},e.prototype.isSmallDesktopWide=function(){return window.innerWidth>this.config.maxWideWidth&&window.innerWidth<=this.config.maxSmallDesktopWideWidth},e.prototype.isWide=function(){return window.innerWidth>this.config.maxNarrowWidth&&window.innerWidth<=this.config.maxWideWidth},e.prototype.isNarrow=function(){return window.innerWidth<=this.config.maxNarrowWidth},e.prototype._initialize=function(){this._initialized=!0,this.isIOS=/(iPad|iPhone|iPod)/g.test(navigator.userAgent),this.meta=b("meta[name=viewport]")[0],this._attachOrientationChange(),this._updateViewport();var a,d=b(window);this.isNarrow()?(a="small",d.trigger("becometonarrow"),d.trigger("narrow")):this.isWide()?(a="large",d.trigger("becometowide"),d.trigger("widen")):this.isSmallDesktopWide()?(a="smalldesktoplarge",d.trigger("becometosmalldesktopwide"),d.trigger("smalldesktopwiden")):(a="extralarge",d.trigger("becometoextrawide"),d.trigger("extrawiden")),d.on("resize",c.debounce(function(){this.isNarrow()?(d.trigger("resizewhennarrow"),"small"!==a&&(a="small",d.trigger("becometonarrow"),d.trigger("narrow"))):this.isWide()?(d.trigger("resizewhenwide"),"large"!==a&&(a="large",d.trigger("becometowide"),d.trigger("widen"))):this.isSmallDesktopWide()?(d.trigger("resizewhensmalldesktopwide"),"smalldesktoplarge"!==a&&(a="smalldesktoplarge",d.trigger("becometosmalldesktopwide"),d.trigger("smalldesktopwiden"))):(d.trigger("resizewhenextrawide"),"extralarge"!==a&&(a="extralarge",d.trigger("becometoextrawide"),d.trigger("extrawiden")))},100).bind(this))},e.prototype._attachOrientationChange=function(){var a=c.bind(this._handleOrientationChange,this);window.addEventListener&&window.addEventListener("orientationchange",a)},e.prototype._handleOrientationChange=function(){this.orientation=!this.orientation,this.isIOS?this._updateViewport():setTimeout(c.bind(this._updateViewport,this),500)},e.prototype._updateViewport=function(){this.isMobileDevice()?this.meta:this.meta&&this.isIOS},e.prototype.isMobileDevice=function(){return 0!==window.orientation&&this.isIOS?Modernizr.mq(this.config.landscape_query):Modernizr.mq(this.config.portrait_query)}}.call(this),function(a){"use strict";a.NR.resolve("SDM.Core.Enums").OptimumLoginEnums={cardNumberValidationResults:{CANNOT_VALIDATE:"cannot-validate",INCOMPLETE:"incomplete",INCOMPLETE_SUBMITTING:"incomplete-submitting",INVALID_CREDENTIALS:"invalid-credentials",INVALID_FORMAT:"invalid-format",INVALID_MOD10:"invalid-mod10",VALID:"valid"},passwordValidationStates:{EMPTY_SUBMITTING:"empty-submitting",INVALID_CREDENTIALS:"invalid-credentials",VALID:"valid"},reCaptchaValidationStates:{INCOMPLETE:"incomplete",SERVER_INVALID:"server-invalid",VALID:"valid"}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Core.Components"),d=b.resolve("SDM.Core.Enums"),e=b.resolve("SDM.Core.Services"),f=c.OptimumMod10Validation,g=d.OptimumLoginEnums,h={cardNumberLength:9},i=e.OptimumLoginService={cardNumberFieldHasDisplayError:function(a){return g.cardNumberValidationResults.INCOMPLETE_SUBMITTING===a||g.cardNumberValidationResults.INVALID_CREDENTIALS===a||g.cardNumberValidationResults.INVALID_FORMAT===a||g.cardNumberValidationResults.INVALID_MOD10===a},getDifferenceInMinutes:function(a,b){return Math.ceil((a-b)/i.minutesToMilliSeconds(1))},getBrowserLockEndTime:function(a,b){return a+i.minutesToMilliSeconds(b)},incrementLoginLockStateTries:function(a,b){return{NumberOfTries:a.NumberOfTries+1,Time:b}},minutesToMilliSeconds:function(a){return 60*a*1e3},validateCardNumber:function(a,b){if(b=b||{},Boolean(b.isMasked))return g.cardNumberValidationResults.VALID;var c=Boolean(b.isSubmitting);return/^\d*$/.test(a)?a.length 1&&!d.isFunction(b))throw new Error("`callback` must be a function.");return this.widgetId=grecaptcha.render(a.get(0),{sitekey:h,callback:b,"expired-callback":e})},b.prototype.getResponse=function(){if(d.isNull(this.widgetId))throw new Error("`getResponse` cannot be invoked before reCaptcha is rendered.");return grecaptcha.getResponse(this.widgetId)},b.prototype.reset=function(){if(d.isNull(this.widgetId))throw new Error("`reset` cannot be invoked before reCaptcha is rendered.");return grecaptcha.reset(this.widgetId)},g.ReCaptchaFactory={getReCaptchaAsync:function(){return j().then(function(){return new b})},isReCaptcha:function(a){return a instanceof b}}}(this),function(){var a=this,b=a._,c=a.jQuery,d=a.SDM||(a.SDM={}),e={},f=a.ResponsiveWindowEvent,g=null,h=!1,i=null,j=d.Util=function(a){var b={lang_code:"",regiion:"",phone_number_reg_exp:/^[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}$/im,postal_code_reg_exp:/(^([0-9]{5})$)|(^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\d{1}[A-Za-z]{1} *\d{1}[A-Za-z]{1}\d{1}$)/,email_reg_exp:/^(([abcdefg.hijklmnopqrstuvwxyz!#$%&'*/=?^_+-`{|}~0123456789]+))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cookies:{postal_code:"sdm-postal-code",province:"sdm-province"},google_api_clientID:"gme-shoppersdrugmart"};e=c.extend(!0,b,a||{}),g=f.getInstance(),h=/(iPad|iPhone|iPod)/g.test(navigator.userAgent)};j.getFullLanguageCode=function(){return e.lang_code},j.getShortLanguageCode=function(){return e.lang_code.substring(0,2)},j.isPhx=function(){return"qc"===e.region},j.getUsersIP=function(){return e.user_ip},j.getValueFromCookie=function(a){var b=document.cookie,c=b.indexOf(" "+a+"=");if(-1===c&&(c=b.indexOf(a+"=")),-1===c)b=null;else{c=b.indexOf("=",c)+1;var d=b.indexOf(";",c);-1===d&&(d=b.length),b=unescape(b.substring(c,d))}return b},j.saveCookie=function(a,b,c,d){document.cookie=c&&d?a+"="+b+";Domain="+c+";expires="+d+"; path=/":c?a+"="+b+";Domain="+c+"; path=/":d?a+"="+b+";expires="+d+"; path=/":a+"="+b+"; path=/"},j.getUrlVars=function(){var a,c={},d=window.location.href,e=d.indexOf("#"),f=d.indexOf("?"),g="";e>0&&e>f?g=d.slice(f+1,e).split("&"):f>0&&(g=d.slice(f+1).split("&")),e>0&&e 0&&(a=d.slice(e+1),c.hash=a),b.each(g,function(a,b){var c=decodeURIComponent(a.replace(/\+/g," "));g[b]=c});for(var h="",i=0;i ");return a.attr("src","https://www.youtube.com/iframe_api"),document.body.appendChild(a.get(0)),window.onYouTubeIframeAPIReady=i.resolve,i},j.loadPinterestApi=function(){return this.pinterest_api_load_promise||(this.pinterest_api_load_promise=c.getScript("//assets.pinterest.com/js/pinit_main.js"))},j.isIOS=function(){return h},j.isMobileDevice=function(){return 0===window.orientation?Modernizr.mq("(max-device-width: 480px)"):Modernizr.mq("screen and (max-width: 480px)")},j.prepareLoadToWinOffersLoadedUrl=function(a){return b.isString(a)?a.indexOf("offersloaded")>=0?a:("/"!==a.slice(-1)&&(a+="/"),a+="offersloaded"):a},j.detectIEVersion=function(){var a=window.navigator.userAgent,b=a.indexOf("MSIE ");if(b>0)return parseInt(a.substring(b+5,a.indexOf(".",b)),10);if(a.indexOf("Trident/")>0){var c=a.indexOf("rv:");return parseInt(a.substring(c+3,a.indexOf(".",c)),10)}var d=a.indexOf("Edge/");return d>0?parseInt(a.substring(d+5,a.indexOf(".",d)),10):-1},j.scrollTo$ElementAsync=function(a,d,e){var f=e||0,g=a.offset().top-f,h="."+b.uniqueId("_event"),i=c("html, body"),j=c(window),k=new c.Deferred;return g-=this.isWindowExtraWide()?this.getHeaderBarHeight():this.getMobileHeaderBarHeight(),j.one("mousewheel"+h,function(){i.stop(),k.resolve()}),i.stop().animate({scrollTop:g},d,function(){j.off(h),k.resolve()}),k.promise()},j.updateLanguageToggleHref=function(a){c("[data-sydicated-language-toggle]").attr("href",a)},j.parseAgilityUrl=function(a){if(!a)return null;try{var b=a.match(/href="([^"]*)"/i);if(!b||!b.length)return null;var c=a.match(/^<[^>]*>([^<]*)<\/a>$/i);if(!c||!c.length)return null;var d=a.match(/target="([^"]*)"/i);return{href:b[1],target:d&&d.length?d[1]:"",text:c[1]}}catch(b){return console.error("Could not parse URL:",a,b),null}},j.convertStringToSlug=function(a){return a?a.toLowerCase().replace(/ +/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-"):""},j.isObject=function(a){return a&&"object"==typeof a&&!Array.isArray(a)},j.mergeObjects=function(a,b){var c=Object.assign({},a);return j.isObject(a)&&j.isObject(b)&&Object.keys(b).forEach(function(d){var e={};e[d]=b[d],j.isObject(b[d])&&d in a?c[d]=j.mergeObjects(a[d],b[d]):Object.assign(c,e)}),c}}.call(this),function(a){"use strict";var b=a.jQuery,c={},d=a.SDM||(a.SDM={}),e=d.Subscription=function(a,d){d=d||{};var e={isEmailSubscribedUrl:"/isSubscribed",signupUrl:"/subscribe"};c=b.extend(!0,{},e,d)};e.isEmailSubscribed=function(a){var d=new b.Deferred;return b.ajax({cache:!1,contentType:"application/x-www-form-urlencoded",type:"POST",url:c.isEmailSubscribedUrl,data:{email:a}}).done(function(a){d.resolve(a)}).fail(function(a){d.reject(a)}),d.promise()},e.signup=function(a,d){var e=new b.Deferred;return console.log(a),console.log(d),b.ajax({cache:!1,contentType:"application/x-www-form-urlencoded",type:"POST",url:c.signupUrl,data:{email:a,casl:d}}).done(function(a){console.log(a),"True"===a?e.resolve(a):e.reject(a)}).fail(function(a){console.log(a),e.reject(a)}),e.promise()}}(this),function(){var a=this,b=a._,c=a.jQuery,d=a.SDM||(a.SDM={}),e={postal_code:null,province:null,is_preferred:!1},f=null,g=d.GeoLocation=function(a){return f=new _GeoLocation(a),f.deferred.promise()};g.getUsersProvince=function(){return e.province},g.getUsersPostalCode=function(){return e.postal_code},g.isPreferredSet=function(){return e.is_preferred},g.setPreferedLocation=function(a){f._savePreferedLocation(a,!0)},_GeoLocation=function(a){var b={domain:"/",is_initialized:!1,geo_info_url:"WebServices/AjaxService.asmx/GetGeoInfoByIP",preferred_location_cookie:"sdm-preferred-location",default_location_cookie:"sdm-location"};this.config=c.extend(!0,b,a||{}),this.deferred=new c.Deferred,this._initialize()},_GeoLocation.prototype._initialize=function(){if(!this.config.is_initialized){var a=d.Util.getValueFromCookie(this.config.preferred_location_cookie);if(a)a=JSON.parse(a),this._saveValues(a,!0);else{var b=d.Util.getValueFromCookie(this.config.default_location_cookie);b?(b=JSON.parse(b),this._saveValues(b,!1)):this._fetchUsersGeoLocation()}this.config.is_initialized=!0}},_GeoLocation.prototype._fetchUsersGeoLocation=function(){var a=b(this._saveFetchedLocation).bind(this);c.ajax({type:"POST",url:this.config.domain+this.config.geo_info_url,data:"{'ipAddress':'"+d.Util.getUsersIP()+"','langCode':'"+d.Util.getFullLanguageCode()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:a})},_GeoLocation.prototype._saveValues=function(a,b){e.postal_code=a.postal_code,e.province=a.province,e.is_preferred=b,this.deferred.resolve()},_GeoLocation.prototype._saveFetchedLocation=function(a){var b={postal_code:a.d.PostalCode,province:a.d.Province};d.Util.saveCookie(this.config.default_location_cookie,JSON.stringify(b)),this._saveValues(b,!1)},_GeoLocation.prototype._savePreferedLocation=function(a){this._saveValues(a,!0),d.Util.saveCookie(this.config.preferred_location_cookie,JSON.stringify(a))}}.call(this),function(a){var b=a._,c=a.moment,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Utils");a.DataLayer={"page-section1":"pc-optimum"};var f=a._satellite||{track:function(){throw new Error("Global _satellite object does not exist.")}},g={ADD_OFFER_TO_LIST:"add-offer-to-list",CLICK_DONT_SHOW_OFFER_AGAIN:"click-dont-show-offer-again",CLICK_SAVE_OFFER_FOR_NEXT_WEEK:"click-save-offer-for-next-week",CUSTOM_LINK:"customlink",DONT_SHOW_OFFER_AGAIN:"dont-show-offer-again",LOAD_OFFERS_SUCCESS:"load-offers-success",LOGGED_IN:"logged-in",LOGGED_OUT:"logged-out",LOGIN_SUCCESS:"login-success",LOGOUT:"logout",PAGE_VIEW:"pageview",REMOVE_OFFER_FROM_LIST:"remove-offer-from-list",SAVE_OFFER_FOR_NEXT_WEEK:"save-offer-for-next-week",VIEW_OFFER_DETAILS:"view-offer-details"},h=function(d,e){var g=c();g.locale("en");var h={"day-of-week":g.format("dddd").toLowerCase(),"hour-of-day":Number(g.format("H")),"utc-timestamp":g.format()};a.DataLayer=b.extend({},a.DataLayer,h,e||{}),console.log("before track:",d,a.DataLayer);try{f.track(d)}catch(a){console.error(a.message)}console.log("after track customlink:",d,a.DataLayer)},i=e.SiteTypes={DESKTOP:"desktop",MOBILE:"mobile"};e.OmnitureUtil={setCustomerWalletId:function(c){return a.DataLayer=b.extend({},a.DataLayer,{"customer-wallet-id":c}),e.OmnitureUtil},setLoginStatus:function(c){return a.DataLayer=b.extend({},a.DataLayer,{"login-status":c?g.LOGGED_IN:g.LOGGED_OUT}),e.OmnitureUtil},setOptimumClaimed:function(c){return a.DataLayer=b.extend({},a.DataLayer,{"optimum-claimed":c?"yes":"no"}),e.OmnitureUtil},setPageLanguage:function(c){return a.DataLayer=b.extend({},a.DataLayer,{"page-language":c}),e.OmnitureUtil},setPageName:function(c){return a.DataLayer=b.extend({},a.DataLayer,{"page-name":c}),e.OmnitureUtil},setSiteType:function(c){if(-1===b.indexOf(b.values(i),c))throw new Error("Invalid `site_type`.");return a.DataLayer=b.extend({},a.DataLayer,{"site-type":c}),e.OmnitureUtil},trackPageView:function(a){return b.isEmpty(a)||e.OmnitureUtil.setPageName(a),h(g.PAGE_VIEW),e.OmnitureUtil},trackLoadOffersSuccess:function(a,b){return h(g.CUSTOM_LINK,{"link-name":g.LOAD_OFFERS_SUCCESS,"offers-per-status":a,"offers-per-template":b}),e.OmnitureUtil},trackAddOfferToList:function(a,b,c){return h(g.CUSTOM_LINK,{"link-name":g.ADD_OFFER_TO_LIST,"offer-template-number":a,"offer-status":b,"offer-name":c}),e.OmnitureUtil},trackRemoveOfferFromList:function(a,b,c){return h(g.CUSTOM_LINK,{"link-name":g.REMOVE_OFFER_FROM_LIST,"offer-template-number":a,"offer-status":b,"offer-name":c}),e.OmnitureUtil},trackClickDontShowOfferAgain:function(a,b,c){return h(g.CUSTOM_LINK,{"link-name":g.CLICK_DONT_SHOW_OFFER_AGAIN,"offer-template-number":a,"offer-status":b,"offer-name":c}),e.OmnitureUtil},trackConfirmDontShowOfferAgain:function(a,b,c){return h(g.CUSTOM_LINK,{"link-name":g.DONT_SHOW_OFFER_AGAIN,"offer-template-number":a,"offer-status":b,"offer-name":c}),e.OmnitureUtil},trackClickSaveOfferForNextWeek:function(a,b,c){return h(g.CUSTOM_LINK,{"link-name":g.CLICK_SAVE_OFFER_FOR_NEXT_WEEK,"offer-template-number":a,"offer-status":b,"offer-name":c}),e.OmnitureUtil},trackConfirmSaveOfferForNextWeek:function(a,b,c){return h(g.CUSTOM_LINK,{"link-name":g.SAVE_OFFER_FOR_NEXT_WEEK,"offer-template-number":a,"offer-status":b,"offer-name":c}),e.OmnitureUtil},trackLoginSuccess:function(){return h(g.CUSTOM_LINK,{"link-name":g.LOGIN_SUCCESS}),e.OmnitureUtil},trackLogout:function(){return h(g.CUSTOM_LINK,{"link-name":g.LOGOUT}),e.OmnitureUtil},trackViewOfferDetails:function(a,b,c){return h(g.CUSTOM_LINK,{"link-name":g.VIEW_OFFER_DETAILS,"offer-template-number":a,"offer-status":b,"offer-name":c}),e.OmnitureUtil}}}(this),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").BlogPost=b.Model.extend({defaults:{description:"",description_short:"",small_image:{},large_image:{},path:"",title:""},initialize:function(){this.preload_small_image=null,this.preload_large_image=null},isSmallImagePreloaded:function(){return this._isImageLoaded.call(this,this.preload_small_image)},isLargeImagePreloaded:function(){return this._isImageLoaded.call(this,this.preload_large_image)},parse:function(a){var b=this.path_prefix||"/";return{id:a.FriendlyUrlName,description:a.Content,description_short:this._stripOuterTags(a.Summary),date:this._parseDate(a.PublicationDate),small_image:this._parseImage(a.ListingImage),large_image:this._parseImage(a.HeroImage),path:b+(a.FriendlyUrlName||"").toLowerCase(),title:a.Title}},_parseDate:function(a){if(!a)return"";a.length>10&&(a=a.substring(0,10));var b=a.split("-");if(b.length<3)return"";var c=new Date(b[0],b[1]-1,b[2]);return isNaN(c.getTime())?"":c.format("%b %r %Y")},_isImageLoaded:function(a){return!_.isNull(a)&&"resolved"===a.promise().state()},_parseImage:function(a){return a&&a.URL?{alt:a.Label||"",src:a.URL||""}:null},_stripOuterTags:function(a){return a.replace(/^<(?:div|p)[^>]*?>([^<]*?)<\/(?:div|p)>$/gi,"$1")},_preloadImage:function(a,b){if(!_.isNull(b))return b.promise();var c,d;return b=new $.Deferred,_.isNull(a)?b.reject():(c=new Image,c.src=a.src,d=$(c),c.onerror=function(){b.reject()},d.one("load",function(){b.resolve(d)})),b.promise()},preloadSmallImage:function(){return this._preloadImage.call(this,this.get("small_image"),this.preload_small_image)},preloadLargeImage:function(){return this._preloadImage.call(this,this.get("large_image"),this.preload_large_image)}})}(this),function(a){"use strict";var b=a.Backbone,c=a.NR||(a.NR={}),d=c.resolve("SDM.Core.Components.Blog"),e=d.BlogPost;d.BlogPostCollection=b.Collection.extend({model:e,initialize:function(a,b){b=b||{},this.url=b.url||_.noop},parse:function(a){return a.Articles},fetch:function(a){return b.Collection.prototype.fetch.call(this,a)}})}(this),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").BlogHeader=b.Model.extend({defaults:{is_categories_visible:!1},toggleIsCategoriesVisible:function(){var a=this.get("is_categories_visible");this.set("is_categories_visible",!a)}})}(this),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").Category=b.Model.extend({idAttribute:"category_id"})}(this),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").Pagination=b.Model.extend({defaults:{num_results_per_page:10,num_total_results:0,page_num:1},getNumTotalPages:function(){var a=this.get("num_total_results"),b=this.get("num_results_per_page");return 0===b?1:Math.max(Math.ceil(a/b),1)},incrementPage:function(){var a=this.get("page_num");a!==this.getNumTotalPages()&&this.set("page_num",a+1)},decrementPage:function(){var a=this.get("page_num");1!==a&&this.set("page_num",a-1)},hasNext:function(){return this.get("page_num") 1}})}(this),function(a){"use strict";var b=a.Backbone,c=a.NR||(a.NR={}),d=c.resolve("SDM.Core.Components.Blog"),e=d.Category;d.CategoryCollection=b.Collection.extend({model:e})}(this),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").SortTypeCollection=b.Collection.extend({model:b.Model,getDefault:function(){return this.findWhere({is_default:!0})||this.first()}})}(this),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").Router=b.Router.extend({routes:{search:"search","*category":"category"}})}(this),function(a){"use strict";var b=a.Backbone,c=a.NR||(a.NR={}),d=c.resolve("SDM.Core.Components.Blog"),e=d.BlogPost,f=d.Category,g=d.CategoryCollection,h=d.Pagination,i=d.SortTypeCollection,j=a.localStorage;d.BlogListing=b.Model.extend({defaults:{category_id:null,has_fetched:!1,homepage_title:"",sort_type:null,search_term:null,sticky_post:null},initialize:function(a){var b,c="BEAUTY_BLOG.sort-type";this.destination_id=a.destination_id||"",this.featuredcontent_id=a.featuredcontent_id||"",this.categories=a.categories||new g([]),this.set("pagination_model",a.pagination_model||new h),this.set("posts",a.posts||new BlogPostCollection([])),this.set("sort_types",a.sort_types||new i([])),this.defaults.sort_type=this.get("sort_types").getDefault().get("type"),j&&(b=j.getItem(c))&&this.set("sort_type",b),this.on("change:category_id change:search_term change:sort_type",function(a,b,c){c.is_reset||this.fetchPosts()},this),this.listenTo(this.getPaginationModel(),"change:page_num",function(a,b,c){c.is_reset||this.fetchPosts()}),this.on("change:sort_type",function(a,b){j&&j.setItem(c,b)})},getActiveCategory:function(){return this.categories.get(this.get("category_id"))||null},getNullCategory:function(){return new f({category_id:null,path:"/",title:this.get("homepage_title")})},getPaginationModel:function(){return this.get("pagination_model")},getPosts:function(){return this.get("posts")},getStickyPost:function(){return this.get("sticky_post")},getSortType:function(){return this.get("sort_type")},resetCategoryId:function(){this.set("category_id",this.defaults.category_id,{is_reset:!0})},resetPageNum:function(){this.getPaginationModel().set("page_num",this.getPaginationModel().defaults.page_num,{is_reset:!0})},resetSearchTerm:function(){this.set("search_term",this.defaults.search_term,{is_reset:!0})},resetSortType:function(){this.set("sort_type",this.defaults.sort_type,{is_reset:!0})},setCategoryId:function(a){this.resetPageNum(),this.resetSearchTerm(),this.set("category_id",a),this.hasChanged()||this.get("has_fetched")||this.fetchPosts(),this.trigger("set-category-id",this,a)},setSearchTerm:function(a){this.resetCategoryId(),this.resetPageNum(),this.resetSortType(),this.set("search_term",a),this.trigger("set-search-term",this,a)},setSortType:function(a){a!==this.getSortType()&&(this.resetPageNum(),this.set("sort_type",a),this.trigger("set-sort-type",this,a))},fetchPosts:function(){var a=_.bind(function(a,b){this.getPaginationModel().set("num_total_results",b.TotalResults),this.set("sticky_post",b.FeaturedArticle?new e(b.FeaturedArticle,{parse:!0}):null)},this),b={CategoryId:this.get("category_id"),DestinationId:this.destination_id,FeaturedContentID:this.featuredcontent_id,Resnum:this.getPaginationModel().get("num_results_per_page"),Page:this.getPaginationModel().get("page_num"),SearchTerm:this.get("search_term"),Desc:"desc"===this.get("sort_type")};this.set("has_fetched",!0),this.getPosts().fetch({data:b,reset:!0,success:a})}})}(this),function(a){"use strict";var b=a._,c=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").BlogHeaderView=c.View.extend({initialize:function(a){this.config=b.result(a,"config",{}),this.listenTo(this.model,"change:is_categories_visible",this.updateCategoriesVisibility),this.elements={$categories_toggle_btn:this.$(this.config.selectors.categories_toggle_btn),$categories:this.$(this.config.selectors.categories),$search:this.$(this.config.selectors.search)},this.events=this.events||{},this.events["click "+this.config.selectors.categories_toggle_btn]="onCategoriesToggleBtnClick",this.events["focus "+this.config.selectors.search_term_input]="onSearchInputFocus",this.events["blur "+this.config.selectors.search_form]="onSearchFormBlur",this.delegateEvents()},onCategoriesToggleBtnClick:function(a){this.model.toggleIsCategoriesVisible(),a.preventDefault()},onSearchInputFocus:function(){this.elements.$search.toggleClass(this.config.classes.search_term_input_expanded,!0)},onSearchFormBlur:function(){this.elements.$search.toggleClass(this.config.classes.search_term_input_expanded,!1)},updateCategoriesVisibility:function(){var a=this.model.get("is_categories_visible");this.elements.$categories.slideToggle(a),this.elements.$categories_toggle_btn.toggleClass(this.config.classes.active_categories_toggle_btn,a)}})}(this),function(a){"use strict";var b=a._,c=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").CategoriesView=c.View.extend({initialize:function(a){this.config=b.result(a,"config",{}),this.listenTo(this.model,"change:category_id",this.render,this),this.events=this.events||{},this.events["click "+this.config.selectors.category_btn]="onCategoryClick",this.events["click "+this.config.selectors.clear_category_btn]="onClearClick",this.delegateEvents()},render:function(){var a=this.model.get("category_id");return b.each(this.$(this.config.selectors.category_btn),function(b){var c=$(b),d=c.data(this.config.data_attributes.category_id)===a;c.toggleClass(this.config.classes.active_category_item,d)},this),this.$(this.config.selectors.clear_category_btn).toggleClass(this.config.classes.active_category_item,b.isNull(a)),this},onCategoryClick:function(a){var b=$(a.currentTarget),c=b.data(this.config.data_attributes.category_id);this.model.setCategoryId(c),a.preventDefault()},onClearClick:function(a){this.model.setCategoryId(null),a.preventDefault()}})}(this),function(a){"use strict";var b=a._,c=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").PaginationView=c.View.extend({initialize:function(a){this.config=b.result(a,"config",{}),this.template=a.template||b.noop,this.listenTo(this.model,"change:num_total_results",this.render),this.listenTo(this.model,"change:page_num",this.render),this.events=this.events||{},this.events["click "+this.config.selectors.pagination_btn]="onPaginationBtnClick",this.events["click "+this.config.selectors.pagination_btn_next]="onNextBtnClick",this.events["click "+this.config.selectors.pagination_btn_prev]="onPrevBtnClick",this.delegateEvents()},render:function(){var a=this.model.getNumTotalPages(),c=this.model.get("page_num"),d=b.range(1,a+1);return d=b.map(d,function(b){return 1===b?b:b===a?b:b===c?b:b<=Math.max(c-2,1)+4&&b>=Math.min(c+2,a)-4?b:null}),d=b.filter(d,function(a,c){return b.isNumber(a)||b.isNumber(d[c-1])}),this.$el.html(this.template({active_page_num:c,btns:d,has_next:this.model.hasNext(),has_prev:this.model.hasPrev()})),this},onPaginationBtnClick:function(a){var b=$(a.currentTarget),c=b.data(this.config.data_attributes.pagination_btn_num);this.model.set("page_num",c),a.preventDefault()},onNextBtnClick:function(a){this.model.incrementPage(),a.preventDefault()},onPrevBtnClick:function(a){this.model.decrementPage(),a.preventDefault()}})}(this),function(a){"use strict";var b=a.jQuery,c=a.Backbone,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Components.Blog"),f=e.BlogPostCollection;e.PostsView=c.View.extend({initialize:function(a){this.template=a.template||_.noop,this.config=_.result(a,"config",{}),this.loading_html=a.loading_html||"",this.no_results_html=a.no_results_html||"",this.no_server_html=a.no_server_html||"",this.listenTo(this.collection,"error",this.renderError),this.listenTo(this.collection,"request",this.showLoading),this.listenTo(this.collection,"reset",this.render)},render:function(){return this.$el.fadeOut(this.config.speeds.fade_out,_.bind(function(){var a=new f;this.$el.empty(),this.collection.size()>0?this.collection.forEach(function(b){var c=b.isSmallImagePreloaded(),d=_.extend({},b.toJSON(),{is_image_loaded:c});c||a.add(b),this.$el.append(this.template(d))},this):_.isNull(this.model.getStickyPost())&&this.showNoResultsMessage(),this.$el.fadeIn(this.config.speeds.fade_in,_.bind(this._onFadeInDone,this,a))},this)),this},renderError:function(){this.$el.html(this.no_server_html)},showLoading:function(){this.$el.html(this.loading_html)},showNoResultsMessage:function(){this.$el.html(this.no_results_html)},_onFadeInDone:function(a){a.forEach(function(a){b.when(a.preloadSmallImage()).done(_.bind(this._onImagePreloadDone,this,a)).fail(_.bind(this._onImagePreloadFail,this,a))},this)},_onImagePreloadDone:function(a,b){var c="[data-"+this.config.data_attributes.post_id+'="'+a.id+'"]';b.addClass(this.config.classes.post_image),b.hide(),this.$(c).find(this.config.selectors.post_loading).replaceWith(b),b.fadeIn(this.config.speeds.fade_in)},_onImagePreloadFail:function(a){var b="[data-"+this.config.data_attributes.post_id+'="'+a.id+'"]';this.$(b).find(this.config.selectors.post_loading).fadeOut(this.config.speeds.fade_out)}})}(this),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").SearchView=b.View.extend({initialize:function(a){this.config=_.result(a,"config",{}),this.listenTo(this.model,"change:search_term",this.render),this.elements={$search_term_input:this.$(this.config.selectors.search_term_input)},this.events=this.events||{},this.events["submit "+this.config.selectors.search_form]="onFormSubmit",this.delegateEvents()},render:function(){var a=this.model.get("search_term");return this.elements.$search_term_input.val(a),this},onFormSubmit:function(a){var b=this.$(this.config.selectors.search_term_input),c=b.val();this.model.setSearchTerm(c),a.preventDefault()}})}(this),function(a){"use strict";var b=a._,c=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").SearchStatusView=c.View.extend({initialize:function(a){this.config=b.result(a,"config",{}),this.template=a.template||b.noop,this.listenTo(this.model,"change:search_term",this.render),this.events=this.events||{},this.events["click "+this.config.selectors.search_clear_btn]="onClearSearchClick",this.delegateEvents()},render:function(){var a=this.model.get("search_term");return a?this.$el.html(this.template({search_term:a})):this.$el.empty(),this},onClearSearchClick:function(a){this.model.setSearchTerm(null),a.preventDefault()}})}(window),function(a){"use strict";var b=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").SortView=b.View.extend({initialize:function(a){this.config=_.result(a,"config",{}),this.listenTo(this.model,"change:sort_type",this.render),this.events=this.events||{},this.events["click "+this.config.selectors.sort_btn]="onSortTypeClick",this.delegateEvents()},render:function(){var a=this.model.get("sort_type");return _.each(this.$(this.config.selectors.sort_btn),function(b){var c=$(b),d=c.data(this.config.data_attributes.sort_btn_type)===a;c.toggleClass(this.config.classes.active_sort_item,d)},this),this},onSortTypeClick:function(a){var b=$(a.currentTarget),c=b.data(this.config.data_attributes.sort_btn_type);b.hasClass(this.config.classes.active_sort_item)||this.model.setSortType(c),a.preventDefault()}})}(this),function(a){"use strict";var b=a.jQuery,c=a._,d=a.Backbone;(a.NR||(a.NR={})).resolve("SDM.Core.Components.Blog").StickyPostView=d.View.extend({initialize:function(a){this.config=c.result(a,"config",{}),this.template=a.template||c.noop,this.listenTo(this.model,"change:sticky_post",this.render)},render:function(){var a=this.model.get("sticky_post");if(c.isNull(a))this.empty();else{var d=a.isLargeImagePreloaded(),e=c.extend({},a.toJSON(),{is_large_image_preloaded:d});this.$el.hide(),d||b.when(a.preloadLargeImage()).done(c.bind(this._onLargeImagePreloadDone,this)).fail(c.bind(this._onLargeImagePreloadFail,this)),this.$el.html(this.template(e)),this.$el.fadeIn(this.config.speeds.fade_in)}return this},empty:function(){this.$el.empty()},_onLargeImagePreloadDone:function(a){a.hide(),this.$(this.config.selectors.sticky_post_image_loading).replaceWith(a),a.fadeIn(this.config.speeds.fade_in)},_onLargeImagePreloadFail:function(){this.$(this.config.selectors.sticky_post_image_loading).fadeOut(this.config.speeds.fade_out)}})}(this),function(a){"use strict";var b=a.jQuery,c=a.Backbone,d=a.TweenLite,e=a.NR||(a.NR={}),f=e.resolve("SDM.Core.Components.Blog"),g=f.BlogHeader,h=f.BlogHeaderView,i=f.CategoriesView,j=f.PaginationView,k=f.PostsView,l=f.SearchView,m=f.SearchStatusView,n=f.SortView,o=f.StickyPostView;f.BlogListingView=c.View.extend({initialize:function(a){var b=this.model.get("posts");this.config=_.result(a,"config",{}),this.categories_view=new i({el:this.$(this.config.selectors.categories).get(0),config:this.config,model:this.model}),this.pagination_view=new j({el:this.$(this.config.selectors.pagination).get(0),config:this.config,model:this.model.get("pagination_model"),template:_.template(this.$(this.config.selectors.pagination_template).html())}),this.posts_view=new k({collection:b,model:this.model,el:this.$(this.config.selectors.posts).get(0),template:_.template(this.$(this.config.selectors.post_template).html()),loading_html:this.$(this.config.selectors.posts_loading_template).html(),no_results_html:this.$(this.config.selectors.no_results_template).html(),no_server_html:this.$(this.config.selectors.no_server_template).html(),config:this.config}),this.search_view=new l({el:this.$(this.config.selectors.search).get(0),config:this.config,model:this.model}),this.sort_view=new n({el:this.$(this.config.selectors.sort_types).get(0),config:this.config,model:this.model}),this.sticky_post_view=new o({el:this.$(this.config.selectors.sticky_post).get(0),config:this.config,model:this.model,template:_.template(this.$(this.config.selectors.sticky_post_template).html())}),this.blog_header_view=new h({el:this.$(this.config.selectors.header).get(0),model:new g,config:this.config}),this.search_status_view=new m({el:this.$(this.config.selectors.search_status).get(0),config:this.config,model:this.model,template:_.template(this.$(this.config.selectors.search_status_template).html())}),this.listenTo(this.model,"change:category_id",this.renderTitle),this.elements={$body:this.$(this.config.selectors.body),$categories_toggle_btn:this.$(this.config.selectors.categories_toggle_btn),$title:this.$(this.config.selectors.title)}, this.listenTo(b,"request",this._onPostsRequest),this.events=this.events||{},this.events["click "+this.config.selectors.categories_toggle_btn]="onCategoriesToggleBtnClick",this.delegateEvents()},render:function(){return this.categories_view.render(),this.sort_view.render(),this.renderTitle(),this.model.get("search_term")&&(this.search_view.render(),this.search_status_view.render()),this},renderTitle:function(){var a=this.model.getActiveCategory(),b=a?a.get("title"):this.model.get("homepage_title");return this.elements.$title.text(b),this},_onPostsRequest:function(){var a,c=70;this.sticky_post_view.empty(),a=this.elements.$body.offset().top-c,d.to(b("body, html"),this.config.speeds.scroll_duration,{scrollTop:a})}})}(this),function(a){(a.NR||(a.NR={})).resolve("SDM.Core.Components.BrooklynAuth").ErrorCodes={NETWORK_ERROR:"network-error",SERVER_ERROR:"server-error"}}(this),function(a){"use strict";var b=a.jQuery,c=a._,d=a.NR||(a.NR={}),e=d.resolve("SDM"),f=d.resolve("SDM.Core.Components.BrooklynAuth"),g=d.resolve("SDM.Core.Components.BrooklynAuth.Settings"),h=f.ErrorCodes,i=((a.location.hostname||"").indexOf("pharmaprix"),"showSdmConvertPopup");f.Repository={getUserEmail:function(){var a=new b.Deferred,d=g.protegrityDomain.replace("{{LANG}}",e.Util.getShortLanguageCode());return b.ajax({cache:!1,xhrFields:{withCredentials:!0},dataType:"json",crossDomain:!0,headers:{"X-Requested-With":"XMLHttpRequest"},type:"GET",url:d}).done(function(b){c.isEmpty(b.Email)?a.reject(h.SERVER_ERROR):a.resolve(b.Email)}).fail(function(b,c,d){console.log(d||c),a.reject(h.NETWORK_ERROR)}),a},hasViewedConvertPopUp:function(){return!c.isEmpty(localStorage.getItem(i))},setHasViewedConvertPopUp:function(){localStorage.setItem(i,!0)},getRefreshedPointsAsync:function(){var a=new b.Deferred;return b.ajax({cache:!1,xhrFields:{withCredentials:!0},dataType:"json",headers:{"X-Requested-With":"XMLHttpRequest"},type:"GET",url:"/Brooklyn/RefreshBrooklynPoints"}).done(function(b){c.isNumber(b)&&b>-1?a.resolve(b):a.reject(h.SERVER_ERROR)}).fail(function(b,c,d){console.log(d||c),a.reject(h.NETWORK_ERROR)}),a.promise()},getOktaConfigurationAsync:function(){var a=new b.Deferred;return b.ajax({cache:!1,dataType:"json",type:"GET",url:"/brooklyn/oktaconfiguration"}).done(function(b){a.resolve(b)}).fail(function(){a.reject(h.NETWORK_ERROR)}),a.promise()}}}(this),function(){this.NR.resolve("SDM.Core.Components.OptimumResponseCodes").Codes={Success:"901",Error:"902",ErrorFatal:"903",UnAuthorized:"904",ReAuthenticate:"905",InvalidField:"906",AccountInactive:"907",AccountLocked:"908",InvalidPassword:"909",Redirect:"910",PasswordReset:"911",InvalidCardNumber:"001",PasswordDoesNotExist:"002",LoginUserLocked:"003",ValidateSuccess:"101",ValidateFail:"102",ValidateLocked:"103",ActivateSuccess:"104",JoinSuccess:"201",TransferSuccess:"301",AddOrRemove:"401"}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Components"),f=d.resolve("SDM.QuickSearchFrequencyDelay"),g=e.Autocomplete=function(a,b){var d={namespace:"autocomplete",min_length:1,show_loading:!1,show_no_result_message:!1,submit_on_enter:!1,input:"[data-widget-autocomplete-input]",template:"[data-widget-autocomplete-template]",loading_template:"",no_result_template:"",fetch_error_html:"",container:"[data-widget-autocomplete-container]",result_list:"[data-widget-autocomplete-list]",result_item:"[data-widget-autocomplete-item]",open_class:"open",selected_class:"selected",on_chose_callback:null,on_select_callback:null,on_chose_clicked_callback:null,fetch_callback:null,focus_callback:null,exit_callback:null,can_fetch_data:null};this.$module=a||c(window),this.config=c.extend(!0,d,b||{}),this._initialize()};g.prototype._initialize=function(){this._setInstanceVars(),this._bindStartEvents()},g.prototype._setInstanceVars=function(){this.$input=this.$module.find(this.config.input),this.$container=this.$module.find(this.config.container)},g.prototype._bindStartEvents=function(){var a=b(this._onInput).bind(this),c=b(this._onFocus).bind(this),d=b(this._choseClicked).bind(this),e=b(this._onBlur).bind(this),f=b(this._stopEnter).bind(this);this.$container.off("click."+this.config.namespace).on("click."+this.config.namespace,this.config.result_item,d),this.$input.off("keyup."+this.config.namespace).on("keyup."+this.config.namespace,a),this.config.submit_on_enter||this.$input.off("keydown."+this.config.namespace).on("keydown."+this.config.namespace,f),this.$input.off("focus."+this.config.namespace).on("focus."+this.config.namespace,a),this.$input.off("blur."+this.config.namespace).on("blur."+this.config.namespace,e),this.$input.off("focus."+this.config.namespace+"start").on("focus."+this.config.namespace+"start",c)},g.prototype._onInput=function(a){switch(a.keyCode){case 13:a.preventDefault(),this._choseSelected(),a.stopPropagation();break;case 38:a.preventDefault(),this._selectPrevious();break;case 40:a.preventDefault(),this._selectNext();break;case 9:this._isOpen()&&this._choseSelected();break;case 27:this._closeAutocomplete();break;default:this._searchOnInput()}},g.prototype._searchOnInput=function(){clearTimeout(this.timeoutSearchOnInput),this.timeoutSearchOnInput=setTimeout(function(){(this.search_term=this.$input.val(),this.search_term.length>=this.config.min_length)?(!b.isFunction(this.config.can_fetch_data)||this.config.can_fetch_data(event,this.search_term))&&this._fetchData():this._closeAutocomplete()}.bind(this),f)},g.prototype._stopEnter=function(a){switch(a.keyCode){case 13:a.preventDefault(),a.stopPropagation()}},g.prototype._onFocus=function(){var a=this.config.focus_callback;b.isFunction(a)&&a.call(this)},g.prototype._onBlur=function(){if(!this._isOpen()){var a=this.config.exit_callback;b.isFunction(a)&&a.call(this)}},g.prototype._fetchData=function(){this.config.show_loading&&this._showLoading();var a=this.config.fetch_callback;if(b.isFunction(a)){var d=a.call(this,this.search_term),e=b(this._renderAutocomplete).bind(this);c.when(d).done(e).fail(b.bind(this._showFetchErrorMessage,this))}},g.prototype._showLoading=function(){var a=b.template(c(this.config.loading_template).html()),d=a();this.$container.html(d),this._openAutocomplete()},g.prototype._showNoResultMessage=function(){var a=b.template(c(this.config.no_result_template)),d=a();this.$container.html(d),this._openAutocomplete()},g.prototype._showFetchErrorMessage=function(){b.isEmpty(this.config.fetch_error_html)||this.$container.html(this.config.fetch_error_html)},g.prototype._renderAutocomplete=function(a){if(a){var d=b.template(c(this.config.template).html()),e=d(a);this.$container.html(e),this._openAutocomplete()}else this.config.show_no_result_message?this._showNoResultMessage():this._closeAutocomplete()},g.prototype._openAutocomplete=function(){var a=this.config.open_class;this._isOpen()||(this.$container.addClass(a),this._bindExitEvent())},g.prototype._closeAutocomplete=function(){var a=this.config.open_class;this._isOpen()&&(this.$container.removeClass(a),this._removeExitEvent())},g.prototype._bindExitEvent=function(){c(window).on("click."+this.config.namespace,b.bind(function(a){if(0===this.$module.find(a.target).length){this._closeAutocomplete();var c=this.config.exit_callback;b.isFunction(c)&&c.call(this)}},this))},g.prototype._removeExitEvent=function(){c(window).off("click."+this.config.namespace)},g.prototype._choseSelected=function(){var a=this._getSelectedItem();if(a.length>0){var c=this.config.on_chose_callback;b.isFunction(c)&&c.call(this,a)}this._closeAutocomplete()},g.prototype._choseClicked=function(a){var d=c(a.currentTarget),e=this.config.on_chose_callback,f=this.config.on_chose_clicked_callback;b.isFunction(e)&&e.call(this,d),b.isFunction(f)&&f.call(this,d),this._closeAutocomplete()},g.prototype._selectNext=function(){var a=this._getSelectedItem(),b=null;a.length>0?(b=a.nextAll(this.config.result_item).first(),b.length>0&&(this._unSelectItem(a),this._selectItem(b))):(b=this.$container.find(this.config.result_item).first(),this._selectItem(b))},g.prototype._selectPrevious=function(){var a=this._getSelectedItem(),b=null;a.length>0&&(b=a.prevAll(this.config.result_item).first(),this._unSelectItem(a),this._selectItem(b))},g.prototype._selectItem=function(a){a.addClass(this.config.selected_class);var c=this.config.on_select_callback;b.isFunction(c)?c.call(this,a,this.search_term):a.length>0?this.$input.val(a.text().trim()):this.$input.val(this.search_term)},g.prototype._unSelectItem=function(a){a.removeClass(this.config.selected_class)},g.prototype._getSelectedItem=function(){return this.$container.find(this.config.result_item).filter("."+this.config.selected_class)},g.prototype._isOpen=function(){var a=this.config.open_class;return this.$container.hasClass(a)},g.prototype.close=function(){this._closeAutocomplete()},g.prototype.open=function(){this._openAutocomplete()},g.prototype.isEmpty=function(){return 0===this.$container.find(this.config.result_item).length}}.call(this),function(){this.formatNumber=function(a,b){var c=/\B(?=(\d{3})+(?!\d))/g,d={en:",",fr:" "};return a.toString().replace(c,d[b]||"")}}.call(this),function(){this.NR.resolve("SDM.Core.Components").OptimumMod10Validation=function(a){for(var b=a.split(""),c=parseInt(b[a.length-1],10),d=9,e=0,f=0;f =c.getTime()},k=function(a,c){return!b.isEmpty(a.PosStartDate)&&new Date(a.PosStartDate).getTime()>=c.getTime()},l=h(new Date);b.each(b.filter(e,j),function(a){a._load_status=i.LOAD_STATUS.UNLOADED,a.Relevance=d,c.push(a),d+=1}),b.each(b.filter(f,j),function(a){a._load_status=i.LOAD_STATUS.LOADED,a.Relevance=d,c.push(a),d+=1}),b.each(b.filter(g,j),function(a){a._load_status=i.LOAD_STATUS.REDEEMED,a.Relevance=d,c.push(a),d+=1});var m=b.reduce(c,function(a,b){return a.TotalCoupons+=1,b._load_status===i.LOAD_STATUS.UNLOADED?(a.AllCoupons+=1,k(b,l)&&(a.NewCoupons+=1,b.IsExclusive&&(a.NewExclusive+=1))):b._load_status===i.LOAD_STATUS.LOADED?a.LoadedCoupons+=1:(b._load_status=i.LOAD_STATUS.REDEEMED)&&(a.RedeemedCoupons+=1),a},{AllCoupons:0,LoadedCoupons:0,RedeemedCoupons:0,TotalCoupons:0,NewCoupons:0,NewExclusive:0});return{Coupons:c,CouponCounts:m}},load:function(a,c){return b(a).each(function(a){a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.LOADING_START)}),k.load(b(a).map(function(a){return a.getId()}),c).done(b(function(c){b(a).each(function(a){b(c).contains(a.getId())?(a.setLoadStatus(i.LOAD_STATUS.LOADED),a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.LOADING_COMPLETE)):a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.LOADING_FAIL)})}).bind(this)).fail(b(function(){b(a).each(function(a){a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.UNLOADING_FAIL)})}).bind(this))},unload:function(a,c){return b(a).each(function(a){a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.UNLOADING_START)}),k.unload(b(a).map(function(a){return a.getId()}),c).done(b(function(c){b(a).each(function(a){b(c).contains(a.getId())?(a.setLoadStatus(i.LOAD_STATUS.UNLOADED),a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.UNLOADING_COMPLETE)):a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.UNLOADING_FAIL)})}).bind(this)).fail(b(function(){b(a).each(function(a){a.setLoadProgressStatus(i.LOAD_PROGRESS_STATUS.UNLOADING_FAIL)})}).bind(this))},fetchSimpleData:function(a){return this._simpleDataDeferred?this._cachedSimpleData&&this._simpleDataDeferred.resolve(this._cachedSimpleData):(this._simpleDataDeferred=c.Deferred(),k.fetchSimpleData(a).then(b(this._parseCouponList).bind(this)).done(b(function(a){this._cachedSimpleData=a,this._simpleDataDeferred.resolve(this._cachedSimpleData)}).bind(this)).fail(b(function(){this._simpleDataDeferred.reject(),this._simpleDataDeferred=null}).bind(this))),this._simpleDataDeferred.promise()},fetchDetails:function(a,c){return k.fetchDetails(b(a).map(function(a){return a.getId()}),c)},fetchContinuityOptInDetails:function(a){return k.fetchContinuityOptInDetails(a)},fetchCoupon:function(a,b){return k.fetchCoupon(a,b).then(function(a){var c=new i(a);return c.isContinuityOptIn()?k.fetchContinuityOptInDetails(b).then(function(a){return a&&a.CouponId&&Number(a.CouponId)===c.getId()&&c.set(a),c}):c})}}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e=a.NR,f=e.resolve("SDM.Core.Components.Coupon"),g=f.CouponModel,h=f.CouponGateway;f.CouponCollection=d.Collection.extend({model:g,initialize:function(){this._language=SDM.Util.getShortLanguageCode(),this.onListSet(this._attachOnLoadAndOnUnloadEventListeners,this),this.onCouponsRemoved(this._detachOnLoadAndOnUnloadEventListeners,this)},_attachOnLoadAndOnUnloadEventListeners:function(a){a=a instanceof d.Collection?a:b([a]),a.each(function(a){a.onLoaded(function(){this.trigger("_coupon-loaded",a)},this),a.onUnloaded(function(a){this.trigger("_coupon-unloaded",a)},this)},this)},_detachOnLoadAndOnUnloadEventListeners:function(a){a=a instanceof d.Collection?a:b([a]),a.each(function(a){a.offLoaded(null,this),a.offUnloaded(null,this)},this)},_getCouponsWithNoDetail:function(){return this.reject(function(a){return a.hasDetail()},this)},_getContinuityOptInsWithNoDetails:function(){return this.filter(function(a){return a.isLoaded()&&a.isContinuityOptIn()&&!a.hasContinuityOptInDetails()},this)},_updateListWithDetails:function(a){return this.set(a,{remove:!1,add:!1}),this},setList:function(a,b){return this.reset(a,b)},removeCoupons:function(a,b){return this.remove(a,b)},onListSet:function(a,b){return this.on("reset",a,b)},onListUpdatedWithDetails:function(a,b){return this.on("_update-list-with-detail",a,b)},onCouponsRemoved:function(a,b){return this.on("remove",a,b)},onCouponRemoveComplete:function(a,b){return this.on("_remove-complete",a,b)},onCouponLoaded:function(a,b){return this.on("_coupon-loaded",a,b)},onCouponUnloaded:function(a,b){return this.on("_coupon-unloaded",a,b)},onFailToFetchDetail:function(a,b){return this.on("_fail-to-fetch-detail",a,b)},loadToCard:function(a){return h.load([this.get(a)],this._language)},loadAllToCard:function(){return h.load(this.filter(function(a){return a.isUnloaded()}),this._language)},unloadToCard:function(a){return h.unload([this.get(a)],this._language)},unloadAllToCard:function(){return h.unload(this.filter(function(a){return a.isLoaded()}),this._language)},fetchDetails:function(){var a=this._getCouponsWithNoDetail(),d=this._getContinuityOptInsWithNoDetails(),e=new c.Deferred,f=new c.Deferred;a.length>0?h.fetchDetails(a,this._language).done(b(function(a){this._updateListWithDetails(a),e.resolve()}).bind(this)).fail(b(function(){e.reject()}).bind(this)):e.resolve(),d.length>0?h.fetchContinuityOptInDetails(this._language).done(b(function(a){b.isEmpty(a)||this._updateListWithDetails(a)}).bind(this)).always(b(function(){f.resolve()}).bind(this)):f.resolve(),c.when(e,f).done(b.bind(function(){this.trigger("_update-list-with-detail")},this)).fail(b.bind(function(){this.trigger("_fail-to-fetch-detail")},this))},areAllCouponsLoaded:function(){return this.every(function(a){return a.isLoaded()})},getIds:function(){return this.map(function(a){return a.getId()}).join(",")},removeComplete:function(){this.trigger("_remove-complete")}})}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e=a.NR,f=e.resolve("SDM.Core.Components.Coupon"),g=f.CouponGateway,h=f.CouponCollection,i=(f.CouponModel,null),j=c(c("[data-widget-coupon-list-csrf-token]").html()).val(),k=null;f.CardModel={getInstance:function(){return null===k&&(k=new i),k}},i=d.Model.extend({initialize:function(){if(!j)throw new Error("The card model needs CSRF token.");this._language=SDM.Util.getShortLanguageCode(),this._collection=new h,this._isSimpleDataReady=!1},url:function(){throw new Error("Url method is forbidden.")},fetch:function(){throw new Error("Fetch method is forbidden.")},getAllCoupons:function(){return this._collection},getAllAvailableCoupons:function(){return new h(this._collection.filter(function(a){return a.isUnloaded()},this))},getExclusiveCoupons:function(){var a=this.getAllAvailableCoupons();return new h(a.filter(function(a){return a.isExclusive()},this))},getLoadedCoupons:function(){return new h(this._collection.filter(function(a){return a.isLoaded()},this))},getRedeemedCoupons:function(){return new h(this._collection.filter(function(a){return a.isRedeemed()},this))},getExclusiveContinuityOptInCoupons:function(){return new h(this._collection.filter(function(a){return a.isContinuityOptIn()&&a.isExclusive()},this))},getContinuityOptInCoupons:function(){return new h(this._collection.filter(function(a){return a.isContinuityOptIn()},this))},getAllAvailableRewardCoupons:function(){return new h(this.getAllAvailableCoupons().filter(function(a){return a.isReward()}))},getNewCouponsCounts:function(){return this._TotalNewCoupons},getNewExclusiveCounts:function(){return this._TotalNewExclusive},onSimpleDataReady:function(a,b){return this._isSimpleDataReady?a.call(b||this):this.on("_simple-data-ready",a,b),this},onFailToFetchSimpleData:function(a,b){return this.on("_fail-to-fetch-simple-data",a,b)},fetchSimpleData:function(){return g.fetchSimpleData(this._language).done(b(function(a){this._isSimpleDataReady||(this._collection.setList(a.Coupons),this._TotalNewCoupons=a.CouponCounts.NewCoupons,this._TotalNewExclusive=a.CouponCounts.NewExclusive,this._isSimpleDataReady=!0,this.trigger("_simple-data-ready"))}).bind(this)).fail(b(function(){this._isSimpleDataReady||this.trigger("_fail-to-fetch-simple-data")}).bind(this))}})}.call(this),function(){var a=this,b=this._,c=a.jQuery,d="coupon-view",e=a.Backbone,f=a.NR,g=f.resolve("SDM.Core.Components.Coupon"),h=f.resolve("SDM.Core.Components.PopUp"),i=null,j={loadButtonContainer:"[data-wg-ct-load-button-container]",removeButtonContainer:"[data-wg-ct-remove-button-container]",redeemedButtonContainer:"[data-wg-ct-redeemed-button-container]",loadButton:"[data-wg-ct-load-button]",viewButton:"[data-wg-ct-view-button]",removeButton:"[data-wg-ct-remove-button]",loadMessage:"[data-wg-ct-load-message]",removeMessage:"[data-wg-ct-remove-message]",errorMessage:"[data-wg-ct-error-message]",loading:"[data-wg-ct-loading]",loadButtonOnDetail:"[data-wg-pcct-load-button-on-detail]",removeButtonOnDetail:"[data-wg-pcct-remove-button-on-detail]",progress:"[data-wg-ct-progress]",progress_bar:"[data-wg-ct-progress-bar]",spent_percent:"[data-wg-ct-spent-percent]"},k={couponContainer:c("[data-widget-coupon-container-template]"),detailModalContent:c("[data-widget-popup-coupon-content-template]"),couponLoading:c("[data-widget-coupon-loading-template]"),coupon:c("[data-widget-coupon-template]")},l={id:"data-wg-ct-id",analyticsTag:"data-wg-ci-analytics-tag",analyticsLabel:"data-wg-ci-analytics-label"},m={continuity_opt_in:"wg-cpi-continuity-opt-in",hero:"wg-cpi-hero",progress_started:"wg-cpi-progress-started"},n=!1;b(k).every(function(a){return a.length>0})&&(k=b.object(b(k).keys(),b(k).map(function(a){return b(a.html()).template()})),i=new h,n=!0),g.CouponView=e.View.extend({initialize:function(){if(this.animating=null,!n)return void console.log("Coupon View couldn't find templates.") ;this.setElement(k.couponContainer({coupon:this.model})),this.model.onLoadingStart(this._onLoadingStart,this),this.model.onLoadingComplete(this._onLoadingComplete,this),this.model.onLoadingFail(this._onLoadingFail,this),this.model.onUnloadingStart(this._onUnloadingStart,this),this.model.onUnloadingComplete(this._onUnloadingComplete,this),this.model.onUnloadingFail(this._onUnloadingFail,this),this.analyticsTag=this.$el.attr(l.analyticsTag),this.isAnimating=!1},stopListening:function(){this.model.offLoadingStart(this._onLoadingStart,this),this.model.offLoadingComplete(this._onLoadingComplete,this),this.model.offLoadingFail(this._onLoadingFail,this),this.model.offUnloadingStart(this._onUnloadingStart,this),this.model.offUnloadingComplete(this._onUnloadingComplete,this),this.model.offUnloadingFail(this._onUnloadingFail,this),e.View.prototype.stopListening.call(this)},_onLoadingStart:function(){this._detailRendered&&(this.buttonsDisabled=!0,this.isAnimating=!0,this.$loading.show())},_onLoadingComplete:function(){this._detailRendered&&(this.$loading.hide(),this._showLoadToCardAnimation().done(b(function(){this.buttonsDisabled=!1,this.isAnimating=!1,this.trigger("_animationComplete")}).bind(this)))},_onLoadingFail:function(){this._detailRendered&&(this.$loading.hide(),this._showErrorOccurredAnimation().done(b(function(){this.buttonsDisabled=!1,this.isAnimating=!1,this.trigger("_animationComplete")}).bind(this)))},_onUnloadingStart:function(){this._detailRendered&&(this.buttonsDisabled=!0,this.isAnimating=!0,this.$loading.show())},_onUnloadingComplete:function(){this._detailRendered&&(this.$loading.hide(),this._showRemoveFromCardAnimation().done(b(function(){this.buttonsDisabled=!1,this.isAnimating=!1,this.trigger("_animationComplete")}).bind(this)))},_onUnloadingFail:function(){this._detailRendered&&(this.$loading.hide(),this._showErrorOccurredAnimation().done(b(function(){this.buttonsDisabled=!1,this.isAnimating=!1,this.trigger("_animationComplete")}).bind(this)))},_renderLoading:function(){return this.$el.html(k.couponLoading()),this.buttonsDisabled=!0,this._detailRendered=!1,this},_renderDetail:function(){return this.$el.html(k.coupon(this.model.getViewModel())),this.buttonsDisabled=!1,this._assignElements(),this._initializeElements(),this._setEventListeners(),this.adjustTextAreaSize(),this._detailRendered=!0,this.model.isContinuityOptIn()&&this.model.hasContinuityOptInDetails()&&this._renderContinuityOptInDetail(),this},_renderContinuityOptInDetail:function(){var a=this.model.getContinuityOptInProgress();this.model.hasContinuityOptInAnimated()||c({percent:0}).delay(1e3).animate({percent:a},{duration:1e3,step:b.bind(this._updateContinuityOptInProgressBar,this)}).promise().done(b.bind(function(){this._updateContinuityOptInProgressBar(a),this.model.setContinuityOptInAnimated(!0)},this))},_updateContinuityOptInProgressBar:function(a){this.$continuityProgressSpent.html(Math.floor(a)),a>0&&this.$continuityProgressContainer.addClass(m.progress_started),this.$continuityProgressBar.width(a+"%")},_adjustTextAreaSize:function(){this.$("[data-ml-text-overflow]").css("height",""),this.$("[data-ml-text-overflow]").mlTextOverflow()},_adjustAmountTextAreaSize:function(){this.$(".wg-cpi-amount span").css("height",""),this.$(".wg-cpi-amount span").mlTextOverflow()},_removeAdjustmentOfAmountTextAreaSize:function(){this.$(".wg-cpi-amount span").css("height",""),this.$(".wg-cpi-amount span").css("max-height","")},_assignElements:function(){this.$loadButtonContainer=this.$(j.loadButtonContainer),this.$removeButtonContainer=this.$(j.removeButtonContainer),this.$redeemedButtonContainer=this.$(j.redeemedButtonContainer),this.$loadButton=this.$(j.loadButton),this.$viewButton=this.$(j.viewButton),this.$removeButton=this.$(j.removeButton),this.$loadMessage=this.$(j.loadMessage),this.$removeMessage=this.$(j.removeMessage),this.$errorMessage=this.$(j.errorMessage),this.$loading=this.$(j.loading),this.$continuityProgressContainer=this.$(j.progress),this.$continuityProgressBar=this.$(j.progress_bar),this.$continuityProgressSpent=this.$(j.spent_percent)},_initializeElements:function(){this.$loadButtonContainer.toggle(this.model.isUnloaded()),this.$removeButtonContainer.toggle(this.model.isLoaded()),this.$redeemedButtonContainer.hide(this.model.isRedeemed()),this.$loadMessage.hide(),this.$removeMessage.hide(),this.$errorMessage.hide(),this.$loading.hide()},_setEventListeners:function(){this.$loadButton.on("click."+d,b(this._onClickLoadButton).bind(this)),this.$viewButton.on("click."+d,b(this._onClickViewButton).bind(this)),this.$removeButton.on("click."+d,b(this._onClickRemoveButton).bind(this))},_onClickLoadButton:function(a){c(a.currentTarget);this.trigger("_clickLoadButton",a,this)},_onClickRemoveButton:function(a){c(a.currentTarget);this.trigger("_clickRemoveButton",a,this)},_onClickViewButton:function(a){c(a.currentTarget);this._showUpDetailModal()},_showLoadToCardAnimation:function(){return c({}).queue(b(function(a){this._fadeInLoadMessage().done(a)}).bind(this)).promise()},_showRemoveFromCardAnimation:function(){return c({}).queue(b(function(a){this._fadeInRemoveMessage().done(a)}).bind(this)).promise()},_showErrorOccurredAnimation:function(){return c({}).queue(b(function(a){this._fadeInErrorMessage().done(a)}).bind(this)).delay(1e3).queue(b(function(a){this._fadeOutErrorMessage().done(a)}).bind(this)).promise()},_fadeInLoadMessage:function(){return this.$loadMessage.stop().fadeIn(400).promise()},_fadeOutLoadMessage:function(){return this.$loadMessage.stop().fadeOut(400).promise()},_fadeInRemoveMessage:function(){return this.$removeMessage.stop().fadeIn(400).promise()},_fadeOutRemoveMessage:function(){return this.$removeMessage.stop().fadeOut(400).promise()},_fadeInErrorMessage:function(){return this.$errorMessage.stop().fadeIn(400).promise()},_fadeOutErrorMessage:function(){return this.$errorMessage.stop().fadeOut(400).promise()},_showUpDetailModal:function(){var a=c(k.detailModalContent(this.model.getViewModel()));a.find(j.loadButtonOnDetail).on("click."+d,b(function(a){i.close(),this._onClickLoadButton(a)}).bind(this)),a.find(j.removeButtonOnDetail).on("click."+d,b(function(a){i.close(),this._onClickRemoveButton(a)}).bind(this)),i.open(a),i.onOpenCompleted(function(){c(".widget-coupon-detail-modal .wg-cpi-description").mlTextOverflow()})},getId:function(){return parseInt(this.$el.attr(l.id),10)},fadeOutContainer:function(){var a=new c.Deferred;return this.isAnimating?this.on("_animationComplete",function(){this.$el.fadeOut(500).promise().done(function(){a.resolve()})},this):this.$el.fadeOut(500).promise().done(function(){a.resolve()}),a},onClickLoadButton:function(a,b){return this.on("_clickLoadButton",a,b)},onClickRemoveButton:function(a,b){return this.on("_clickRemoveButton",a,b)},adjustTextAreaSize:function(){return this._adjustTextAreaSize(),this.$el.hasClass(m.featured)||this._adjustAmountTextAreaSize(),this},renderLoading:function(){return this._renderLoading()},renderDetail:function(){return this._renderDetail()},addHeroClass:function(){return this.$el.addClass(m.hero),this._removeAdjustmentOfAmountTextAreaSize(),this},addContinuityOptInClass:function(){return this.$el.addClass(m.continuity_opt_in),this}})}.call(this),function(){var a=this,b=this._,c=a.jQuery,d=a.Backbone,e=a.NR,f=e.resolve("SDM.Core.Components.Coupon"),g=f.CouponView,h={container:c("[data-widget-coupon-list-container-template]"),list:c("[data-widget-coupon-list-template]"),listItem:c("[data-widget-coupon-list-item-template]"),loading:c("[data-widget-coupon-list-loading-template]"),noResult:c("[data-widget-coupon-list-no-result-template]"),error:c("[data-widget-coupon-list-error-template]")},i=!1;b(h).every(function(a){return a.length>0})&&(h=b.object(b(h).keys(),b(h).map(function(a){return b(a.html()).template()})),i=!0),f.CouponListView=d.View.extend({initialize:function(a){if(h=c.extend(!0,h,a.templates||{}),!i)return void console.log("Coupon List View couldn't find templates.");this.collection=this.model,this.setElement(h.container()),this.$list=c(h.list()),this.$loading=c(h.loading()),this.$noResult=this.options.$noResult?this.options.$noResult:c(h.noResult()),this.getNoResultsHtml=a.getNoResultsHtml||null,this.$error=c(h.error()),this.couponViews={},this.collection.onListSet(this._renderList,this),this.collection.onListUpdatedWithDetails(this._renderCouponDetails,this),this.collection.onCouponsRemoved(this._removeCouponFromList,this),this.collection.onFailToFetchDetail(this._renderErrorMessage,this),this._renderLoading()},_renderLoading:function(){return this.$el.html(this.$loading),this},_renderList:function(){if(b.isObject(this.couponViews)&&b.each(this.couponViews,function(a){a.stopListening()}),this.model.size()>0)this.$el.html(this.$list),this.$list.empty(),this.couponViews=this._createViewItems(this.model),this.model.each(function(a){this._addCouponViewTo$list(a),this._initializeCouponView(a),a.hasDetail()&&this.couponViews[a.getId()].renderDetail()},this);else{var a=b.isFunction(this.getNoResultsHtml)?this.getNoResultsHtml():this.$noResult;this.$el.html(a),this.couponViews={}}return this},_renderCouponDetails:function(){b(this.couponViews).each(function(a){a.renderDetail()},this)},_renderErrorMessage:function(){return this.$el.html(this.$error),this},_removeCouponFromList:function(a){a=b(a).isArray()?a:[a];var d=[];return b(a).each(function(a){var b=this.couponViews[a.getId()];b&&d.push(b.fadeOutContainer())},this),c.when.apply(c,d).done(b.bind(function(){this.model.removeComplete(a)},this)),this},_createViewItems:function(a){return b.object(a.map(function(a){return a.getId()}),a.map(function(a){return new g({model:a})}))},_addCouponViewTo$list:function(a){var b=this._get$CouponListItemContainer(),c=this.couponViews[a.getId()];return this._add$ListItemTo$List(this.$list,b,c,a),this},_initializeCouponView:function(a){var c=this.couponViews[a.getId()];return c.renderLoading(),c.onClickLoadButton(b(function(a,b){this.collection.loadToCard(b.getId())}).bind(this)),c.onClickRemoveButton(b(function(a,b){this.collection.unloadToCard(b.getId())}).bind(this)),this},_add$ListItemTo$List:function(a,b,c,d){b.html(c.el),a.append(b)},_get$CouponListItemContainer:function(){return c(h.listItem())},adjustTextAreaSizeViewItems:function(){return b(this.couponViews).each(function(a){a.adjustTextAreaSize()},this),this},renderErrorMessage:function(){return this._renderErrorMessage()},overrideAddItemViewMethod:function(a){this._add$ListItemTo$List=a},getItemView:function(a){return this.couponViews[a]}})}.call(this),function(){var a=this,b=this._,c=a.Backbone;a.NR.resolve("SDM.Core.Components").FlyerModel=c.Model.extend({config:{price_saving_regex:/ (.*)<\/PriceSavings>/i},defaults:{IsLoaded:!1},set:function(a,d){if(void 0===a.CouponId||b(a.CouponId).isNumber()||(a.CouponId=parseInt(a.CouponId,10)),void 0===a.PosStartDate||a.PosStartDate instanceof Date||(a.PosStartDate=new Date(a.PosStartDate)),void 0===a.PosEndDate||a.PosEndDate instanceof Date||(a.PosEndDate=new Date(a.PosEndDate)),void 0===a.DisplayStartDate||a.DisplayStartDate instanceof Date||(a.DisplayStartDate=new Date(a.DisplayStartDate)),void 0===a.DisplayEndDate||a.DisplayEndDate instanceof Date||(a.DisplayEndDate=new Date(a.DisplayEndDate)),void 0===a.PosStartDate||a.PosStartDate instanceof Date||(a.PosStartDate=new Date(a.PosStartDate)),void 0===a.PosEndDate||a.PosEndDate instanceof Date||(a.PosEndDate=new Date(a.PosEndDate)),void 0!==a.LongDescriptionHeader){var e=this.config.price_saving_regex.exec(a.LongDescriptionHeader);e=null!==e?e[1]:"",a.PriceSavings=$.trim(e)}return c.Model.prototype.set.call(this,a,d)},idAttribute:"CouponId",getId:function(){return this.id},getProductName:function(){return this.get("RequirementDescription")},getPrice:function(){return this.get("ShortDescription")},getOfferType:function(){return this.get("OfferTypes")},getBrands:function(){return this.get("Brands")},getCategories:function(){return this.get("Categories")},getPosStartDate:function(){return this.get("PosStartDate")},getPosEndDate:function(){return this.get("PosEndDate")},getPosStartTimeStamp:function(){return this.getPosStartDate().getTime()},getPosEndTimeStamp:function(){return this.getPosEndDate().getTime()},getPosDateRange:function(){var a=Math.abs(this.getPosEndDate().getTime()-this.getPosStartDate().getTime());return Math.ceil(a/864e5)},getImage:function(){return this.get("Image")},getBadge:function(){return this.get("Badge")},getLongDescriptionHeader:function(){return this.get("LongDescriptionHeader")},getPriceSavings:function(){return this.get("PriceSavings")},showPriceSavings:function(){var a=this.getPriceSavings().toLowerCase(),c=this.getPrice().toLowerCase();return!(!a||b.isEqual(a,"n/a")||b.isEqual(a,c))},hasBadge:function(){return!!this.get("Badge")},hasDetail:function(){return!!this.getProductName()},hasRangeLessThanFlyer:function(){return this.get("RangeLessThanFlyer")},isLoaded:function(){return this.get("IsLoaded")},setRangeLessThanFlyer:function(a){this.set("RangeLessThanFlyer",a)}})}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e=a.NR,f=e.resolve("SDM.Core.Components"),g=f.FlyerModel;f.FlyerCollection=d.Collection.extend({defaults:{initialSetting:!1,_isSimpleDataReady:!1},model:g,initialize:function(){this.language=SDM.Util.getShortLanguageCode(),this.on("_simpleDataReady",this.updateEffectiveDates)},isSimpleDataReady:function(){return this._isSimpleDataReady},onSimpleDataReady:function(a,b){this.isSimpleDataReady()?a.call(b||this):this.on("_simpleDataReady",a,b)},setList:function(a,b){return this.reset(a,b)},removeFlyers:function(a,b){return this.remove(a,b)},onListSet:function(a,b){return this.on("reset",a,b)},onFetchError:function(a,b){return this.on("error-fetch",a,b)},onFlyersRemoved:function(a,b){return this.on("remove",a,b)},getIdsWithNoDetail:function(){var a=[];return this.each(function(b){b.hasDetail()||a.push(b.getId())}),a},flyerSimpleListURL:function(){var a={coupons:!1,UTCMinutesOffset:(new Date).getTimezoneMinuteOffset()};return"//"+document.location.host+"/"+this.language+"/optimum/getallcoupons?"+c.param(a)},flyerDetailListURL:function(){var a={Ids:this.getIdsWithNoDetail().join(","),coupons:!1,UTCMinutesOffset:(new Date).getTimezoneMinuteOffset()};return"//"+document.location.host+"/"+this.language+"/optimum/getcoupondetails?"+c.param(a)},fetchSimple:function(){var a="http:"===location.protocol,c={cache:!1,crossDomain:a,xhrFields:{withCredentials:!0},headers:{"X-Requested-With":"XMLHttpRequest"}};return this.fetchURL=this.flyerSimpleListURL,d.Collection.prototype.fetch.call(this,c).done(b(function(){this.trigger("_simpleDataReady")}).bind(this))},fetchDetails:function(){var a="http:"===location.protocol,b={remove:!1,add:!1,cache:!1,crossDomain:a,xhrFields:{withCredentials:!0},headers:{"X-Requested-With":"XMLHttpRequest"}};return this.fetchURL=this.flyerDetailListURL,this.getIdsWithNoDetail().length>0&&d.Collection.prototype.fetch.call(this,b),this},url:function(){return this.fetchURL()},updateEffectiveDates:function(){if(this.length>0){this.effectiveStartDate=b.min(this.models,function(a){return a.getPosStartTimeStamp()}).getPosStartDate(),this.effectiveEndDate=b.max(this.models,function(a){return a.getPosEndTimeStamp()}).getPosEndDate();var a=Math.abs(this.effectiveEndDate.getTime()-this.effectiveStartDate.getTime()),c=Math.ceil(a/864e5);this.effectiveDateRange=c,this.each(function(a){a.getPosDateRange() a.getFullYear(),d="";return d=c?"%A, %b %r %Y":"%A, %b %r",a=a.format(d,this.language),b=b.format(d,this.language),{effectiveStartDate:a,effectiveEndDate:b}}return null},getIds:function(){return this.map(function(a){return a.getId()}).join(",")}})}.call(this),function(){var a=this,b=this._,c=a.jQuery,d=a.Backbone,e=a.NR,f=e.resolve("SDM.Core.Components"),g={flyerContainer:c("[data-widget-flyer-container-template]"),flyerLoading:c("[data-widget-flyer-loading-template]"),flyer:c("[data-widget-flyer-template]")},h=!1;b(g).every(function(a){return a.length>0})&&(g=b.object(b(g).keys(),b(g).map(function(a){return b(a.html()).template()})),h=!0),f.FlyerView=d.View.extend({initialize:function(){if(!h)return void console.log("Flyer View couldn't find templates.");this.setElement(g.flyerContainer({flyer:this.model})),this._render(),this.model.on("change",this._onChange,this),this.model.on("adjust-text-area-size",this.adjustTextAreaSize,this)},_onChange:function(){this._render()},_render:function(){return this.model.hasDetail()?(this.$el.html(g.flyer({flyer:this.model})),this.adjustTextAreaSize()):this.$el.html(g.flyerLoading()),this},adjustTextAreaSize:function(){this.$("[data-ml-text-overflow]").css("height","").mlTextOverflow()}})}.call(this),function(){var a=this,b=this._,c=a.jQuery,d=a.Backbone,e=a.NR,f=e.resolve("SDM.Core.Components"),g=f.FlyerView,h={container:c("[data-widget-flyer-list-container-template]"),list:c("[data-widget-flyer-list-template]"),listItem:c("[data-widget-flyer-list-item-template]"),loading:c("[data-widget-flyer-list-loading-template]"),noResult:c("[data-widget-flyer-list-no-result-template]"),fetchErrorMessage:c("[data-widget-flyer-list-error-template]")},i=!1;b(h).every(function(a){return a.length>0})&&(h=b.object(b(h).keys(),b(h).map(function(a){return b(a.html()).template()})),i=!0),f.FlyerListView=d.View.extend({initialize:function(){if(!i)return void console.log("Flyer List View couldn't find templates.");this.setElement(h.container()),this.$list=c(h.list()),this.$loading=c(h.loading()),this.$noResult=c(h.noResult()),this.$fetchErrorMessage=c(h.fetchErrorMessage()),this._showLoading(),this.model.onSimpleDataReady(this._onReady,this),this.model.onFlyersRemoved(this._onReady,this),this.model.onListSet(this._onReady,this),this.model.onFetchError(this._showFetchError,this)},_onReady:function(){return this.model.size()>0?(this._showList(),this._renderList()):this._showNoResult(),this},_showFetchError:function(){this.$el.html(this.$fetchErrorMessage)},_showList:function(){this.$el.html(this.$list)},_showLoading:function(){this.$el.html(this.$loading)},_showNoResult:function(){this.$el.html(this.$noResult)},_renderList:function(){this.$list.empty(),this.model.each(b(function(a){this._addFlyer(a)}).bind(this))},_addFlyer:function(a){var b=new g({model:a}),d=c(h.listItem()),e=this.$list.children().length;this.trigger("_onAddedItem",d,e),this.$list.append(d),d.html(b.el),a.trigger("adjust-text-area-size")},onAddedItem:function(a,b){this.on("_onAddedItem",a,b)},adjustTextAreaSize:function(){this.model.each(b(function(a){a.trigger("adjust-text-area-size")}).bind(this))}})}.call(this),function(){var a=this,b=this._,c=a.jQuery,d="coupon-view",e=a.Backbone,f=a.NR,g=f.resolve("SDM.Core.Components"),h={numberList:"[data-wg-pt-pagination-list]",nextButton:"[data-wg-pt-next-button]",prevButton:"[data-wg-pt-prev-button]",numberButton:"[data-wg-plt-number-button]"},i={container:c("[data-widget-pagination-template]"),numberItem:c("[data-widget-pagination-number-list-item-template]"),omissionItem:c("[data-widget-pagination-number-list-omission-item-template]")},j=!1;b(i).every(function(a){return a.length>0})&&(i=b.object(b(i).keys(),b(i).map(function(a){return b(a.html()).template()})),j=!0),g.PaginationView=e.View.extend({initialize:function(){if(!j)return void console.log("Pagination View couldn't find templates.");this.setElement(i.container()),this.findElements(),this.setViewEvents(),this.renderList(),this.model.onChangeNumberOfPages(this.onModelChangeNumberOfPages,this),this.model.onChangeCurrentPage(this.onModelChangeCurrentPage,this)},onModelChangeNumberOfPages:function(){this.renderList(),this.updateToggleButtons()},onModelChangeCurrentPage:function(){this.renderList(),this.updateToggleButtons()},findElements:function(){this.$numberList=this.$el.find(h.numberList),this.$nextButton=this.$el.find(h.nextButton),this.$prevButton=this.$el.find(h.prevButton)},setViewEvents:function(){this.$nextButton.on("click."+d,b(this.onClickNextButton).bind(this)),this.$prevButton.on("click."+d,b(this.onClickPrevButton).bind(this)),this.$el.on("click."+d,h.numberButton,b(this.onClickNumberButton).bind(this))},renderList:function(){return this.$numberList.empty(),b(this.model.getPaginationArray()).each(b(function(a){b(a.number).isNumber()?this.$numberList.append(i.numberItem({number:a.number,isCurrent:a.isCurrent})):this.$numberList.append(i.omissionItem())}).bind(this)),this},updateToggleButtons:function(){return 1===this.model.getCurrentPage()||this.model.getNumberOfPages()<=1?this.$prevButton.css("display","none"):this.$prevButton.css("display",""),this.model.getCurrentPage()===this.model.getNumberOfPages()||this.model.getNumberOfPages()<=1?this.$nextButton.css("display","none"):this.$nextButton.css("display",""),this},show$el:function(){this.$el.show()},hide$el:function(){this.$el.hide()},onClickNextButton:function(){this.model.setCurrentPage(this.model.getCurrentPage()+1)},onClickPrevButton:function(){this.model.setCurrentPage(this.model.getCurrentPage()-1)},onClickNumberButton:function(a){var b=parseInt(c(a.currentTarget).attr("data-wg-plt-number-button"));this.model.setCurrentPage(b)}})}.call(this),function(){var a=this,b=this._,c=(a.jQuery,a.Backbone);a.NR.resolve("SDM.Core.Components").PaginationModel=c.Model.extend({defaults:{_numberOfPages:20,_currentPage:10,_visibleRange:3},getNumberOfPages:function(){return this.get("_numberOfPages")},getCurrentPage:function(){return this.get("_currentPage")},getVisibleRange:function(){return this.get("_visibleRange")},getPaginationArray:function(){var a=[],c=this.getNumberOfPages(),d=this.getCurrentPage(),e=this.getVisibleRange(),f=d-Math.floor(e/2),g=d+Math.floor(e/2),h=0,i=0,j=!1;return f<1&&(i=1-f),c ',popthat:'',modal:'',close:'',content:''},events:{triggers:{open_completed:"open-completed",close_completed:"close-completed"}}}},h.prototype.addClassToContainer=function(a){return this.$popthat.addClass(a)},h.prototype.removeClassFromContainer=function(a){return this.$popthat.removeClass(a)},h.prototype.reposition=function(){var a=d.prototype.reposition.apply(this,arguments);return this.$popthat.trigger(this.NAME+"-repositioned"),a},h.prototype.onOpenCompleted=function(a){this.$popthat.on("open-completed",a)},h.prototype.onCloseCompleted=function(a){this.$popthat.on("close-completed",a)},h.prototype.offCloseCompleted=function(a){this.$popthat.off("close-completed",a)},h.prototype.onRepositioned=function(a){this.$popthat.on(this.NAME+"-repositioned",a)},h.prototype.silentlyReposition=function(a){this._animateModal(a,{reposition:c.bind(function(a,b,d){var e={top:d.top,left:d.left,width:d.innerwidth,height:d.innerheight},f=this.config.animation.open,g=c.bind(function(){b.css({overflow:"visible"})},this);b.stop().animate(e,f,g)},this)})},h.prototype._injectBackground=function(){var a=b('[role="main"]');a.length||(a=b("body")),this.$background=b(this.templates.background()).appendTo(a)},h.prototype._injectPopThat=function(){var a=b('[role="main"]');a.length||(a=b("body")),this.$popthat=b(this.templates.popthat()),this.config.id&&this.$popthat.prop("id",this.config.id),this._bindPopThat(),this.$popthat.appendTo(a)},h.prototype.isOpen=function(){return Boolean(this.$modal&&this.$modal.length)}}.call(this),function(){var a=this,b=a.Backbone;a.NR.resolve("SDM.Core.Components").ResultNumbersView=b.View.extend({initialize:function(){this.$start=this.options.$start,this.$end=this.options.$end,this.$sum=this.options.$sum,this.model.onChangeStart(this.onModelChangeStart,this),this.model.onChangeEnd(this.onModelChangeEnd,this),this.model.onChangeSum(this.onModelChangeSum,this)},onModelChangeStart:function(){this.$start.html(this.model.getStart())},onModelChangeEnd:function(){this.$end.html(this.model.getEnd())},onModelChangeSum:function(){this.$sum.html(this.model.getSum())}})}.call(this),function(){var a=this,b=a.Backbone;a.NR.resolve("SDM.Core.Components").ResultNumbersModel=b.Model.extend({defaults:{_start:0,_end:0,_sum:0},update:function(a,b,c){this.set("_start",Math.min(c,a*(b-1)+1)),this.set("_end",Math.min(c,a*b)),this.set("_sum",c)},getStart:function(){return this.get("_start")},getEnd:function(){return this.get("_end")},getSum:function(){return this.get("_sum")},onChangeStart:function(a,b){this.on("change:_start",a,b)},onChangeEnd:function(a,b){this.on("change:_end",a,b)},onChangeSum:function(a,b){this.on("change:_sum",a,b)}})}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR,e=d.resolve("SDM.Core.Components"),f=e.TabGroup=function(a,b){var d={selectors:{container:"[data-widget-tab-group]",button:"[data-wg-tbg-button]",content:"[data-wg-tbg-content]"},attributes:{button:"data-wg-tbg-button",content:"data-wg-tbg-content",buttonActiveClass:"data-wg-tbg-button-active",contentActiveClass:"data-wg-tbg-content-active"},classnames:{buttonDefault:"active",contentDefault:"active"}};this.config=c.extend(!0,d,b||{}),this._initialize(a)};f.prototype._initialize=function(a){this._$element=a=a.is(this.config.selectors.container)?a:a.find(this.config.selectors.container),a.length>0&&(this._buttonActiveClass=a.attr(this.config.attributes.buttonActiveClass)||this.config.classnames.buttonDefault,this._containerActiveClass=a.attr(this.config.attributes.contentActiveClass)||this.config.classnames.contentDefault,this._$buttons=a.find(this.config.selectors.button),this._$contents=a.find(this.config.selectors.content),this._callbacks={_click:[],_switch:[]},this._setEventListener())},f.prototype._setEventListener=function(){this._$buttons.on("click.tabgroup",b(this._onClickButton).bind(this))},f.prototype._onClickButton=function(a){var b=c(a.currentTarget).attr(this.config.attributes.button);this._updateTab(b,!1)},f.prototype._updateTab=function(a,c){var d=this._$buttons.filter("["+this.config.attributes.button+'="'+a+'"]'),e=this._$contents.filter("["+this.config.attributes.content+'="'+a+'"]'),f=this._getIdsOfCurrentActiveButtons();this._$buttons.removeClass(this._buttonActiveClass),d.addClass(this._buttonActiveClass),this._$contents.removeClass(this._containerActiveClass),e.addClass(this._containerActiveClass),c||this._fireCallbacks("_click",a,d,e,this._$element),c||b(f).contains(a)||this._fireCallbacks("_switch",a,d,e,this._$element)},f.prototype._getIdsOfCurrentActiveButtons=function(){return b(this._getActive$Buttons()).map(b(function(a){return c(a).attr(this.config.attributes.button)}).bind(this))},f.prototype._getActive$Buttons=function(){return this._$buttons.filter(b(function(a,b){return c(b).hasClass(this._buttonActiveClass)}).bind(this))},f.prototype._fireCallbacks=function(a){var c=this._callbacks[a],d=arguments.length>0?Array.prototype.slice.call(arguments,1):[];c&&b(c).each(b(function(a){a.apply(this,d)}).bind(this))},f.prototype.onClickButton=function(a){return b.isObject(this._callbacks)&&this._callbacks._click.push(a),this},f.prototype.onSwitch=function(a){return b.isObject(this._callbacks)&&this._callbacks._switch.push(a),this},f.prototype.goToTab=function(a,b){return this._updateTab(a,b),this}}.call(this),function(){var a=this,b=a.jQuery,c=a._,d=NR.resolve("SDM.Core.Components"),e=d.VimeoVideoPlayer=function(a){var c={$container:null,event_handlers:{}};this.config=b.extend(!0,c,a||{}),this._initialize()};e.fn=e.prototype,e.fn._initialize=function(){if(!1===c.isObject(this.config.event_handlers))throw new Error("Event hanlders must be an object.");if(this.vimeo_id=null,this.is_ready=b.Deferred(),this.$container=this.config.$container,0==!!this.$container.attr("id"))return console.log("Vimeo player container must have an id attribute."),null;this.vimeo_id=this.config.vimeo_id,this.event_handlers={},c.each(this.config.event_handlers,function(a,b){this._setEventHandler(b,a)},this),this.player=null},e.fn._create=function(){var a=this.$container.attr("id")+"-iframe",d="//player.vimeo.com/video/"+this.vimeo_id+"?api=1&player_id="+a;this.$iframe?this.$iframe.attr("src",d):this.$iframe=this.$iframe||b("",{id:a,src:d}),this.$container.append(this.$iframe),this.player=$f(this.$iframe[0]),this.player.addEvent("ready",c(function(a){this.is_ready.resolve(),this.player.addEvent("play",c(function(){this._fire("play")}).bind(this)),this.player.addEvent("pause",c(function(){this._fire("pause")}).bind(this)),this.player.addEvent("finish",c(function(){this._fire("finish")}).bind(this)),this._fire("ready")}).bind(this))},e.fn._isReady=function(){return"resolved"===this.is_ready.state()},e.fn._fire=function(a){if(!1===c.isString(a))throw new Error("An event id is required.");if(!0===c.has(this.event_handlers,a))for(var b=this.event_handlers[a],d=0,e=b.length;d -1&&this.event_handlers[a].splice(d,1)}else!1===c.isUndefined(a)?!0===c.has(this.event_handlers,a)&&(this.event_handlers[a]=[]):this.event_handlers={};return this},e.fn._loadFroogaloopApi=function(){return c.isUndefined(this.froogaloop_api_promise)&&(this.froogaloop_api_promise=b.getScript("/static/core/vendors/froogaloop/froogaloop.js")),this.froogaloop_api_promise},e.fn.create=function(a){if(!0===c.isUndefined(a))throw new Error("A vimeo id is required.");return this.vimeo_id=a,b.when(this._loadFroogaloopApi()).then(c(this._create).bind(this)).fail(function(){console.log("Failed to load Froogaloop API.")}),this.is_ready},e.fn.play=function(){if(!1!==this._isReady())return this.player.api("play"),this},e.fn.pause=function(){if(!1!==this._isReady())return this.player.api("pause"),this},e.fn.destroy=function(){if(!1!==this._isReady()){try{this.$iframe.removeAttr("src"),this.$container.empty()}catch(a){}return this.player=null,this.is_ready=b.Deferred(),null}},e.fn.load=function(a){return this.vimeo_id=a,this.destroy(),this.create(a)},e.fn.loadAndPlay=function(a){this.vimeo_id=a,this.destroy() ;var d=this.create(a);return b.when(d).then(c(this.play).bind(this)),d},e.fn.hasPlayer=function(){return!1===c.isNull(this.player)}}.call(this),function(){var a=this,b=a.jQuery,c=a._,d=NR.resolve("SDM.Core.Components"),e=function(b){a.onYouTubeIframeAPIReady=b},f=null,g=d.YoutubeVideoPlayer=function(a){var c={is_mobile:!1,$container:null,event_handlers:{}};this.config=b.extend(!0,c,a||{}),this._initialize()};g.fn=g.prototype,g.fn._initialize=function(){if(!1===c.isObject(this.config.event_handlers))throw new Error("Event hanlders must be an object.");if(this.youtube_id=null,this.is_ready=b.Deferred(),this.$container=this.config.$container,0==!!this.$container.attr("id"))return console.log("Youtube player container must have an id attribute."),null;this.event_handlers={},c.each(this.config.event_handlers,function(a,b){this._setEventHandler(b,a)},this),this.player=null},g.fn._create=function(){f=a.YT;var d=this.$container.attr("id"),e=d+"-innercontainer",g=b("",{id:e});this.$container.empty().append(g),this.player=new f.Player(e,{videoId:this.youtube_id,playerVars:{wmode:"opaque",controls:this.config.is_mobile?0:1,rel:0},events:{onReady:c(function(){this.is_ready.resolve(),this._fire("ready")}).bind(this),onStateChange:c(function(a){f.PlayerState.ENDED===a.data?this._fire("finish"):f.PlayerState.PLAYING===a.data?this._fire("play"):f.PlayerState.PAUSED===a.data&&this._fire("pause")}).bind(this)}})},g.fn._isReady=function(){return"resolved"===this.is_ready.state()},g.fn._fire=function(a){if(!1===c.isString(a))throw new Error("An event id is required.");if(!0===c.has(this.event_handlers,a))for(var b=this.event_handlers[a],d=0,e=b.length;d -1&&this.event_handlers[a].splice(d,1)}else!1===c.isUndefined(a)?!0===c.has(this.event_handlers,a)&&(this.event_handlers[a]=[]):this.event_handlers={};return this},g.fn._loadYoutubeIframeApi=function(){if(c.isUndefined(this.youtube_iframe_api_promise)){var d=this;d.youtube_iframe_api_promise=new b.Deferred,b.getScript("https://www.youtube.com/iframe_api"),e(function(){d.youtube_iframe_api_promise.resolve(),a.isYouTubeIframeAPIReady=!0})}return this.youtube_iframe_api_promise},g.fn.create=function(d){if(!0===c.isUndefined(d))throw new Error("A youtube id is required.");return this.youtube_id=d,b.when(a.isYouTubeIframeAPIReady||this._loadYoutubeIframeApi()).then(c(this._create).bind(this)).fail(function(){console.log("Failed to load Youtube API.")}),this.is_ready},g.fn.play=function(){if(!1!==this._isReady())return this.player.playVideo(),this},g.fn.pause=function(){if(!1!==this._isReady())return this.player.pauseVideo(),this},g.fn.destroy=function(){if(!1!==this._isReady())return this.player.stopVideo(),this.$container.empty(),this.player=null,this.is_ready=b.Deferred(),null},g.fn.load=function(a){if(!1!==this._isReady())return this.youtube_id=a,this.player.cueVideoById(this.youtube_id),this.is_ready},g.fn.loadAndPlay=function(a){if(!1!==this._isReady())return this.youtube_id=a,this.player.loadVideoById(this.youtube_id),this.is_ready},g.fn.hasPlayer=function(){return!1===c.isNull(this.player)}}.call(this),function(){var a=this,b=a.jQuery,c=a._,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Components"),f=d.resolve("SDM.Core.Components.VimeoVideoPlayer"),g=d.resolve("SDM.Core.Components.YoutubeVideoPlayer"),h=e.VideoPlayer=function(a){var c={$container:null,event_handlers:{}};this.config=b.extend(!0,c,a||{}),this._initialize()};h.fn=h.prototype,h.type={YOUTUBE:0,VIMEO:1},h.fn._initialize=function(){if(!0===c.isNull(this.config.$container))throw new Error("A container element (jQuery object) must be set at construction.");this.current_type=null,this.apis={}},h.fn.getCurrentApi=function(){return!0===c.isNull(this.current_type)?null:this._getApi(this.current_type)},h.fn._getApi=function(a){if(!1===c.has(this.apis,a))if(h.type.YOUTUBE===a)this.apis[a]=new g(this.config);else{if(h.type.VIMEO!==a)throw new Error("Unknown type.");this.apis[a]=new f(this.config)}return this.apis[a]},h.fn.load=function(a,d,e){if(!0===c.isUndefined(d))throw new Error("A video id is required.");if(!1===c.isUndefined(e)&&!1===c.isFunction(e))throw new Error("Callback must be a function.");var f,g=this._getApi(a);a!==this.current_type&&!1===c.isNull(this.getCurrentApi())&&this.getCurrentApi().destroy(),this.current_type=a,f=!1===g.hasPlayer()?g.create(d):g.load(d),!0===c.isFunction(e)&&b.when(f).then(b.proxy(e,this))},h.fn.loadAndPlay=function(a,b){this.load(a,b,function(){this.play()})},h.fn.play=function(){var a=this.getCurrentApi();if(console.log(a),!0===c.isNull(a))throw new Error("Could not get current player.");return a.play.call(a)},h.fn.pause=function(){var a=this.getCurrentApi();if(!0===c.isNull(a))throw new Error("Could not get current player.");return a.pause.call(a)},h.fn.destroy=function(){var a=this.getCurrentApi();if(!0===c.isNull(a))throw new Error("Could not get current player.");return a.destroy.call(a)}}.call(this),function(){var a=this,b=a.jQuery,c=a._,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Components"),f=d.resolve("SDM.Core.Components.VideoPlayer"),g=d.resolve("SDM.Util"),h=e.VideoPanel=function(a,c){var d="fr"==g.getShortLanguageCode()?"ferme":"Close",e={attributes:{video_player_container:"data-wg-vp-video-player-container",video_player_id:"data-wg-vp-video-player-id",youtube_id:"data-wg-vp-youtube-id",vimeo_id:"data-wg-vp-vimeo-id"},classes:{panel_has_open_modal:"wg-vp-panel-has-open-modal",pc_video_container_class:"",mobile_video_container_class:""},selectors:{container:"[data-widget-video-panel]",button_play:"[data-wg-vp-play]",button_stop:"[data-wg-vp-stop]",is_panel_mobile:"[data-wg-vp-mobile]"},templates:{modal_pc:'',modal_mobile:'',close_button:''}};this.config=b.extend(!0,e,{},c||{}),this._setInstanceVars(a),this._initialize()};h.prototype._setInstanceVars=function(a){this.$container=a.$container,this.$closeButtonContainer=a.$closeButtonContainer,this.$modalContainer=!c.isUndefined(a.$modalContainer)&&a.$modalContainer.length?a.$modalContainer:a.$container,this._subscribers={},this._is_mobile=this.$container.length&&this.$container.is(this.config.selectors.is_panel_mobile),this._is_modal_open=!1},h.prototype._initialize=function(){if(!this.$container.is(this.config.selectors.container))return console.log("A carousel video panel container has to have attribute "+this.config.selectors.container+"."),void console.log(this.$container[0]);this.video_player_id=this.$container.attr(this.config.attributes.video_player_id);var a=this.$container.attr(this.config.attributes.youtube_id),d=this.$container.attr(this.config.attributes.vimeo_id);if(c.isUndefined(this.video_player_id))return console.log("A carousel video panel container must have a "+this.config.attributes.video_player_id+" attribute."),void console.log(this.$container[0]);if(c.isUndefined(a)&&c.isUndefined(d))return console.log("A carousel video panel container must have either "+this.config.attributes.youtube_id+" attribute or "+this.config.attributes.vimeo_id+" attribute."),void console.log(this.$container[0]);try{this.mobile_modal_template=c.template(this.config.templates.modal_mobile)}catch(a){return void console.log("Invalid mobile modal template.")}try{this.pc_modal_template=c.template(this.config.templates.modal_pc)}catch(a){return void console.log("Invalid pc modal template.")}if(!(this.$closeButtonContainer&&this.$closeButtonContainer.length>0))return void console.log("No close button container found.");var e=c.template(this.config.templates.close_button)();this.$closeButtonContainer.append(e),!0===this.$container.is("["+this.config.attributes.youtube_id+"]")?(this.video_type=f.type.YOUTUBE,this.video_id=a):!0===this.$container.is("["+this.config.attributes.vimeo_id+"]")&&(this.video_type=f.type.VIMEO,this.video_id=d);var g=this._is_mobile?this.mobile_modal_template:this.pc_modal_template;this.$modal=b(g({video_player_container_attr:this.config.attributes.video_player_container,video_player_id:this.video_player_id}));var h=this.$modal.find("["+this.config.attributes.video_player_container+"]");this.$modalContainer.append(this.$modal),this.videoPlayer=new f({$container:h,is_mobile:this._is_mobile,event_handlers:{pause:c(this._onVideoPause).bind(this),finish:c(this._onVideoFinish).bind(this)}}),this.bindClickPlayButtonEvent()},h.prototype._fire=function(a){if(!0===c.has(this._subscribers,a)){var b=Array.prototype.slice.call(arguments,1);c.each(this._subscribers[a],c(function(a){a.apply(this,b)}).bind(this))}},h.prototype._hide=function(){this._is_modal_open=!1,this.$container.removeClass(this.config.classes.panel_has_open_modal),this.videoPlayer.destroy(),this._fire("modal.close")},h.prototype._show=function(){this._is_modal_open=!0,this._fire("modal.open"),this.$container.addClass(this.config.classes.panel_has_open_modal),this.bindClickStopButtonEvent(),SDM.Util.isWindowWide()?this.videoPlayer.loadAndPlay(this.video_type,this.video_id):this.videoPlayer.load(this.video_type,this.video_id)},h.prototype.isModalOpen=function(){return this._is_modal_open},h.prototype.bindClickPlayButtonEvent=function(){this.$container.off("click",this.config.selectors.button_play).on("click",this.config.selectors.button_play,c(function(a){a.preventDefault(),this._show()}).bind(this))},h.prototype.bindClickStopButtonEvent=function(){this.$closeButtonContainer.off("click",this.config.selectors.button_stop).on("click",this.config.selectors.button_stop,c(function(a){a.preventDefault(),this._hide()}).bind(this))},h.prototype._onVideoPause=function(){!0===this._is_mobile&&this.video_type===f.type.VIMEO&&this._hide()},h.prototype._onVideoFinish=function(){this._hide()},h.prototype.on=function(a,b){return!1===c.has(this._subscribers,a)&&(this._subscribers[a]=[]),this._subscribers[a].push(b),this},h.prototype.off=function(a,b){if(!0===c.has(this._subscribers,a)){var d=c.indexOf(this._subscribers[a],b);d>-1&&this._subscribers[a].splice(d,1)}return this},h.prototype.closeModal=function(){!1!==this.isModalOpen()&&this._hide()},h.prototype.getId=function(){return this.video_player_id}}.call(this),function(){var a=this,b=a.jQuery,c=a._,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Components"),f=d.resolve("SDM.Core.Components.VideoPlayer"),g=e.VideoPanelDeeplink=function(a,c){var d={attributes:{video_player_container:"data-wg-vp-video-player-container",video_player_id:"data-wg-vp-video-player-id",youtube_id:"data-wg-vp-youtube-id",vimeo_id:"data-wg-vp-vimeo-id"},classes:{panel_has_open_modal:"wg-vp-panel-has-open-modal",pc_video_container_class:"",mobile_video_container_class:""},selectors:{container:"[data-widget-video-panel]",button_play:"[data-wg-vp-play]",button_stop:"[data-wg-vp-stop]",is_panel_mobile:"[data-wg-vp-mobile]"},templates:{modal_pc:'',modal_mobile:'',close_button:''}};this.config=b.extend(!0,d,{},c||{}),this._setInstanceVars(a),this._initialize()};g.prototype._setInstanceVars=function(a){this.$container=a.$container,this.$closeButtonContainer=a.$closeButtonContainer,this.$modalContainer=!c.isUndefined(a.$modalContainer)&&a.$modalContainer.length?a.$modalContainer:a.$container,this._subscribers={},this._is_modal_open=!1,this._hide=function(a){var d=this;if(this._is_modal_open=!1,b(".wg-gt__tile-video-modal-popup").removeClass(this.config.classes.panel_has_open_modal),this.videoPlayer.destroy(),this._fire("modal.close"),b(".wg-gt__tile-video-modal-container").velocity({top:"100%"},300),setTimeout(c.bind(function(){b(document.body).css("position","relative"),b(document.body).css("top",""),b(document.body).css("width",""),window.scrollTo(0,d.modalScrollY)},this),0),setTimeout(c.bind(function(){b(".widget-video-panel-modal").remove()},this),300),history.pushState&&!a){var e=window.location.protocol+"//"+window.location.host+window.location.pathname;window.history.pushState({path:e},"",e)}}},g.prototype._initialize=function(){if(this.video_player_id=this.$container.ID,"youtube"===this.$container.VideoType&&(this.video_id=this.$container.URL,this.video_type=f.type.YOUTUBE),"vimeo"===this.$container.VideoType&&(this.video_id=this.$container.URL,this.video_type=f.type.VIMEO),c.isUndefined(this.video_player_id))return console.log("A carousel video panel container must have a "+this.config.attributes.video_player_id+" attribute."),void console.log(this.$container[0]);try{this.mobile_modal_template=c.template(this.config.templates.modal_mobile)}catch(a){return void console.log("Invalid mobile modal template.")}try{this.pc_modal_template=c.template(this.config.templates.modal_pc)}catch(a){return void console.log("Invalid pc modal template.")}if(!(this.$closeButtonContainer&&this.$closeButtonContainer.length>0))return void console.log("No close button container found.");var a=c.template(this.config.templates.close_button)();this.$closeButtonContainer.append(a);var d=this._is_mobile?this.mobile_modal_template:this.pc_modal_template;this.$modal=b(d({video_player_container_attr:this.config.attributes.video_player_container,video_player_id:this.video_player_id}));var e=this.$modal.find("["+this.config.attributes.video_player_container+"]");this.$modalContainer.append(this.$modal),this.videoPlayer=new f({$container:e,is_mobile:this._is_mobile,event_handlers:{pause:c(this._onVideoPause).bind(this),finish:c(this._onVideoFinish).bind(this)}}),this._show()},g.prototype._fire=function(a){if(!0===c.has(this._subscribers,a)){var b=Array.prototype.slice.call(arguments,1);c.each(this._subscribers[a],c(function(a){a.apply(this,b)}).bind(this))}},g.prototype._show=function(){this._is_modal_open=!0,this._fire("modal.open"),this.modalScrollY=window.scrollY,b(".wg-gt__tile-video-modal-popup").addClass(this.config.classes.panel_has_open_modal),this.bindClickStopButtonEvent(),SDM.Util.isWindowWide()?this.videoPlayer.loadAndPlay(this.video_type,this.video_id):this.videoPlayer.load(this.video_type,this.video_id)},g.prototype.isModalOpen=function(){return this._is_modal_open},g.prototype.bindClickPlayButtonEvent=function(){this.$container.off("click",this.config.selectors.button_play).on("click",this.config.selectors.button_play,c(function(a){a.preventDefault(),this._show()}).bind(this))},g.prototype.bindClickStopButtonEvent=function(){this.$closeButtonContainer.off("click",this.config.selectors.button_stop).on("click",this.config.selectors.button_stop,c(function(a){a.preventDefault()}).bind(this))},g.prototype._onVideoPause=function(){!0===this._is_mobile&&this.video_type===f.type.VIMEO&&this._hide(!1)},g.prototype._onVideoFinish=function(){this._hide(!1)},g.prototype.on=function(a,b){return!1===c.has(this._subscribers,a)&&(this._subscribers[a]=[]),this._subscribers[a].push(b),this},g.prototype.off=function(a,b){if(!0===c.has(this._subscribers,a)){var d=c.indexOf(this._subscribers[a],b);d>-1&&this._subscribers[a].splice(d,1)}return this},g.prototype.closeModal=function(){!1!==this.isModalOpen()&&this._hide(!1)},g.prototype.getId=function(){return this.video_player_id}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR||(a.NR={}),e=a.CarouselView,f=a.CarouselModel,g=a.CarouselViewAnimations,h=d.resolve("SDM.Core.Components"),i=h.SliderCarouselController=function(a,b){var d={toggle_at_once:null,circulate:!1,swipe:{min_move_x:5}};this.config=c.extend(!0,d,{},b||{}),this._setInstanceVars(a)};i.prototype._setInstanceVars=function(a){this.view=new e({$container:a.$container}),this.model=new f({number_of_panels:this.view.getPanelSize()}),this.no_duration_animation=g.slide(0),this.callbacks={}},i.prototype._fire=function(a,c){c=b(c).isArray()?c:[],this.callbacks[a]&&b(this.callbacks[a]).each(function(a){a.apply({},c)})},i.prototype.off=function(a){this.callbacks[a]&&(this.callbacks[a]=[])},i.prototype.on=function(a,b){this.callbacks[a]&&this.callbacks[a].push(b)},i.prototype.bindModelEvents=function(){this.model.on("changeIndex",b(function(){this.updateToggleButtonVisibility(),this.updatePaginationButtonActiveClass(),this.animateCarousel()}).bind(this))},i.prototype.bindViewEvents=function(){this.view.off("clickNextButton"),this.view.on("clickNextButton",b(function(){this.goToNext()}).bind(this)),this.view.off("clickPreviousButton"),this.view.on("clickPreviousButton",b(function(){this.goToPrevious()}).bind(this)),this.view.off("clickPaginationButton"),this.view.on("clickPaginationButton",b(function(a){this.model.setIndex(a.index)}).bind(this)),this.view.off("resize"),this.view.on("resize",b(function(){var a=this.view.$container.find(this.view.selectors.panel).eq(this.getCurrentIndex());0!==a.length&&(c(this.view.selectors.panel_container,this.view.$container)[0].style.left="-"+a.position().left+"px")}).bind(this)),this.view.off("swipePanelContainer"),this.view.on("swipePanelContainer",b(function(a,b,c){this.config.swipe.min_move_x<=b?(this.goToNext(),a.preventDefault()):b<=-this.config.swipe.min_move_x&&(this.goToPrevious(),a.preventDefault())}).bind(this))},i.prototype.goToNext=function(){null!==this.model.getIndexOfNextBreakPoint(this.config.circulate)&&(this.config.toggle_at_once?this.model.setIndex(this.model.getAdvancedIndex(this.config.toggle_at_once,!1)):this.model.setIndex(this.model.getIndexOfNextBreakPoint(this.config.circulate)))},i.prototype.goToPrevious=function(){null!==this.model.getIndexOfPreviousBreakPoint(this.config.circulate)&&(this.config.toggle_at_once?this.model.setIndex(this.model.getEarlierIndex(this.config.toggle_at_once,!1)):this.model.setIndex(this.model.getIndexOfPreviousBreakPoint(this.config.circulate)))},i.prototype.updateToggleButtonVisibility=function(){null!==this.model.getIndexOfNextBreakPoint(this.config.circulate)?this.view.showNextButton():this.view.hideNextButton(),null!==this.model.getIndexOfPreviousBreakPoint(this.config.circulate)?this.view.showPreviousButton():this.view.hidePreviousButton()},i.prototype.getCurrentIndex=function(){return this.model.getCurrentIndex()},i.prototype.updatePaginationButtonActiveClass=function(){this.view.activatePaginationButton(this.model.getCurrentIndex())},i.prototype.updatePaginationButtonVisibility=function(){this.view.showAndHidePaginationButtonByFilterCallback(b(function(a){return this.model.size()>this.model.number_of_visible&&this.model.isBreakPointIndex(a)}).bind(this))},i.prototype.animateCarousel=function(){this.view.animate(this.model.getCurrentIndex())},i.prototype.setModelIndexSilently=function(a){var b=this.view.getAnimation();this.view.setAnimation(this.no_duration_animation),this.model.setIndex(a),this.model.isValidIndex(a)&&this.view.animate(a),this.view.setAnimation(b)},i.prototype.setToggleAtOnce=function(a){this.config.toggle_at_once=a},i.prototype.setPanelWidth=function(a){this.view.setPanelWidth(a)},i.prototype.removePanelWidth=function(){this.view.removePanelWidth()},i.prototype.setNumberOfVisible=function(a){this.model.setNumberOfVisible(a)},i.prototype.getCarouselWidth=function(){return this.view.getCarouselWidth()},i.prototype.setAnimation=function(a){this.view.setAnimation(a)},i.prototype.renderPanels=function(a){this.view.renderPanels(a)},i.prototype.renderPaginationButtons=function(a){this.view.renderPaginationButtons(a)},i.prototype.setNumberOfPanels=function(a){this.model.setNumberOfPanels(a)},i.prototype.hideMainContainer=function(){this.view.hidePanelContainer(),this.view.makePaginationButtonContainerInvisible(),this.view.hideNextButton(),this.view.hidePreviousButton()},i.prototype.showMainContainer=function(){this.view.showPanelContainer(),this.view.makePaginationButtonContainerVisible()}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Components"),f="slider-carousel",g=a.CarouselViewAnimations,h=e.SliderCarouselController,i=e.VideoPanel,j=null;j=e.SliderCarousel=function(a,b){var d={selectors:{carousel_container:"[data-wg-scrs-carousel-container]",video_panel:"[data-widget-video-panel]",video_container:"[data-wg-scrs-video-container]",close_button_container:"[data-wg-scrs-video-close-button-container]",text_overflow:"[data-ml-text-overflow]"},attributes:{pc_visible:"wg-scrs-number-visible-pc",tablet_visible:"wg-scrs-number-visible-tablet",mob_visible:"wg-scrs-number-visible-mob",pc_toggle_at_once:"wg-scrs-toggle-at-once-pc",tablet_toggle_at_once:"wg-scrs-toggle-at-once-tablet",mob_toggle_at_once:"wg-scrs-toggle-at-once-mob",circulate:"wg-scrs-circulate"},setting:{pc:{animation_duration:500,number_of_visible:3,toggle_at_once:!1},tablet:{animation_duration:500,number_of_visible:2,toggle_at_once:!1},mob:{animation_duration:500,number_of_visible:1,toggle_at_once:!1}}};this.config=c.extend(!0,d,b||{}),this._setInstanceVars(a),this._initialize(),this._initializeDesktopVideoPanels()},j.prototype._setInstanceVars=function(a){this.$container=a.find(this.config.selectors.carousel_container),this.videoPanels={},this.$module=a,this.controller=new h({$container:this.$container},{circulate:a.data(this.config.attributes.circulate)}),this.pc_animation=g.slide(this.config.setting.pc.animation_duration),this.tablet_animation=g.slide(this.config.setting.tablet.animation_duration),this.mob_animation=g.slide(this.config.setting.mob.animation_duration),this.config.setting.pc.number_of_visible=parseInt(a.data(this.config.attributes.pc_visible),10)||this.config.setting.pc.number_of_visible,this.config.setting.tablet.number_of_visible=parseInt(a.data(this.config.attributes.tablet_visible),10)||this.config.setting.tablet.number_of_visible,this.config.setting.mob.number_of_visible=parseFloat(a.data(this.config.attributes.mob_visible),10)||this.config.setting.mob.number_of_visible,this.config.setting.pc.toggle_at_once=parseInt(a.data(this.config.attributes.pc_toggle_at_once),10)||this.config.setting.pc.toggle_at_once,this.config.setting.tablet.toggle_at_once=parseInt(a.data(this.config.attributes.tablet_toggle_at_once),10)||this.config.setting.tablet.toggle_at_once,this.config.setting.mob.toggle_at_once=parseInt(a.data(this.config.attributes.mob_toggle_at_once),10)||this.config.setting.mob.toggle_at_once},j.prototype._initialize=function(){this.controller.bindViewEvents(),this.controller.bindModelEvents(),this._updateMode(),this._bindResizeEvents()},j.prototype._initializeDesktopVideoPanels=function(){var a=this.$module.find(this.config.selectors.video_panel);b.each(a,b(function(a){var d=c(a),e=new i({$modalContainer:d.find(this.config.selectors.video_container),$container:d,$closeButtonContainer:d.find(this.config.selectors.close_button_container)});e.on("modal.open",b(function(){this._closeAllVideosBut(e.getId())}).bind(this)),this.videoPanels[e.getId()]=e}).bind(this)),this.controller.model.on("changeIndex",b(function(){b.each(this.videoPanels,function(a){a.closeModal()})}).bind(this))},j.prototype._updateTextOverflows=function(){this.$container.find(this.config.selectors.text_overflow).mlTextOverflow()},j.prototype._updateMode=function(){SDM.Util.isWindowNarrow()?this._switchModeToMobile():SDM.Util.isWindowWide()?this._switchModeToTablet():this._switchModeToPC()},j.prototype._closeAllVideosBut=function(a){b.each(this.videoPanels,function(b,c){c!==a&&b.closeModal()})},j.prototype._switchModeToPC=function(){this.controller.setNumberOfVisible(this.config.setting.pc.number_of_visible),this.controller.setAnimation(this.pc_animation),this.controller.setModelIndexSilently(0),this._removeMobPanelWidth(),this.controller.updateToggleButtonVisibility(),this.controller.updatePaginationButtonVisibility(),this.controller.updatePaginationButtonActiveClass(),this.controller.setToggleAtOnce(this.config.setting.pc.toggle_at_once),setTimeout(b.bind(this._updateTextOverflows,this),0)},j.prototype._switchModeToTablet=function(){this.controller.setNumberOfVisible(this.config.setting.tablet.number_of_visible),this.controller.setAnimation(this.tablet_animation),this.controller.setModelIndexSilently(0),this._removeMobPanelWidth(),this.controller.updateToggleButtonVisibility(),this.controller.updatePaginationButtonVisibility(),this.controller.updatePaginationButtonActiveClass(),this.controller.setToggleAtOnce(this.config.setting.tablet.toggle_at_once),setTimeout(b.bind(this._updateTextOverflows,this),0)},j.prototype._switchModeToMobile=function(){this.controller.setNumberOfVisible(this.config.setting.mob.number_of_visible),this.controller.setAnimation(this.mob_animation),this.controller.setModelIndexSilently(0),this._setMobPanelWidth(),this.controller.updateToggleButtonVisibility(),this.controller.updatePaginationButtonVisibility(),this.controller.updatePaginationButtonActiveClass(),this.controller.setToggleAtOnce(this.config.setting.mob.toggle_at_once),setTimeout(b.bind(this._updateTextOverflows,this),0)},j.prototype._setMobPanelWidth=function(){var a=this.$container.width(),b=Math.floor(a/this.config.setting.mob.number_of_visible);b<=0||this.controller.setPanelWidth(b)},j.prototype._removeMobPanelWidth=function(){this.controller.removePanelWidth()},j.prototype._bindResizeEvents=function(){c(window).on("becometoextrawide."+f,b(function(){this._switchModeToPC()}).bind(this)),c(window).on("becometowide."+f,b(function(){this._switchModeToTablet()}).bind(this)),c(window).on("becometonarrow."+f,b(function(){this._switchModeToMobile()}).bind(this)),c(window).on("resizewhennarrow."+f,b(function(){this._setMobPanelWidth(),this.controller.setModelIndexSilently(this.controller.getCurrentIndex())}).bind(this))},j.prototype.renderPanels=function(a){this.controller.renderPanels(a)},j.prototype.renderPaginationButtons=function(a){this.controller.renderPaginationButtons(a)},j.prototype.setNumberOfPanels=function(a){this.controller.setNumberOfPanels(a),this._updateMode()},j.prototype.hideMainContainer=function(){this.controller.hideMainContainer()},j.prototype.showMainContainer=function(){this.controller.showMainContainer()},j.prototype.updateMode=function(){this._updateMode()}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR||(a.NR={}),e=a.CarouselView,f=a.CarouselModel,g=a.CarouselViewAnimations,h=d.resolve("SDM.Core.Components"),i=d.resolve("SDM.Core.Components.SliderCarousel"),j=d.resolve("SDM.Core.Components.VideoPanel"),k=null;k=h.HeroCarousel=function(a,b){var d={number_of_visible:1,rotate_duration:6e3,animation_duration:1e3,selectors:{pc_carousel:"[data-wg-hcrs-pc-carousel]",mobile_carousel:"[data-wg-hcrs-mobile-carousel]",panel:"[data-wg-crs-panel]",video_panel:"[data-widget-video-panel]",video_container:"[data-wg-hcp-video-container]",close_button_container:"[data-wg-hcp-video-close-button-container]"},data:{seenSlides:[]}};this.config=c.extend(!0,d,b||{}),this.videoPanels=[],this._setInstanceVars(a),this._initialize(),this._initializeDesktopVideoPanels()},k.prototype._setInstanceVars=function(a){this.view=new e({$container:a.find(this.config.selectors.pc_carousel)}),this.model=new f({number_of_panels:this.view.getPanelSize()}),this.mobile_carousel=new i(a.find(this.config.selectors.mobile_carousel)),this.autoRotationIntervalId=null,c(window).on("becometonarrow.sdm-hero-carousel",b(function(){this._switchModeToMobile()}).bind(this))},k.prototype._initialize=function(){if(this.view.setAnimation(g.fade(this.config.animation_duration)),this.view.makeContainerVisible(),this.model.setNumberOfVisible(this.config.number_of_visible),this._bindViewEvents(),this._bindModelEvents(),this._animateCarousel(),this._updateToggleButtonVisibility(),this._updatePaginationButtonActiveClass(),this._startAutoRotation(),window.location.href.includes("home")){for(var a=this.view.$container.find(this.config.selectors.panel),b=a.length,c=this;b--;)a[b].addEventListener("click",function(){var a=this.getAttribute("data-index");c._slideClick(a)}),a[b].addEventListener("auxclick",function(){var a=this.getAttribute("data-index");c._slideClick(a)});null===sessionStorage.getItem("seenAllSlides")?this._isElementInView(a[0])&&(dataLayer.push({event:"slide_impression","slide.position":0,"slide.image_url":document.body.querySelector('.wg-hcp-panel[data-index="0"] .wg-hcp-lnk-image').src}),sessionStorage.setItem("seenAllSlides",[0]),this.config.seenSlides=sessionStorage.getItem("seenAllSlides")):this.config.seenSlides=sessionStorage.getItem("seenAllSlides")}},k.prototype._initializeDesktopVideoPanels=function(){var a=this.view.$container.find(this.config.selectors.video_panel);b.each(a,function(a){var d=c(a),e=new j({$modalContainer:d.find(this.config.selectors.video_container),$container:d,$closeButtonContainer:this.view.$container.find(this.config.selectors.close_button_container)});e.on("modal.open",b(function(){this._stopAutoRotation()}).bind(this)),this.videoPanels.push(e)},this)},k.prototype._switchModeToMobile=function(){b.each(this.videoPanels,function(a){a.closeModal()},this)},k.prototype._updateToggleButtonVisibility=function(){this.view.showNextButton(),this.view.showPreviousButton()},k.prototype._updatePaginationButtonActiveClass=function(){this.view.activatePaginationButton(this.model.getCurrentIndex())},k.prototype._slideClick=function(a){window.location.href.includes("home")&&dataLayer.push({event:"slide_click","slide.position":a,"slide.image_url":document.body.querySelector('.wg-hcp-panel[data-index="'+a+'"] .wg-hcp-lnk-image').src})},k.prototype._isElementInView=function(a){var b=a.getBoundingClientRect(),c=b.top,d=b.top+b.height;return c>=0&&d<=Math.min(document.documentElement.clientHeight,window.innerHeight||0)},k.prototype._sendSlideToAnalytics=function(){if(window.location.href.includes("home")){var a=this.view.$container.find(this.config.selectors.panel);this._isElementInView(a[this.model.getCurrentIndex()])&&this.config.data.seenSlides.length b?d+this.paddingRate*d*2:b,g=e>c?e+this.paddingRate*e*2:c;this.$largeFrame.width(f),this.$largeFrame.height(g),this.offsetX=a.left,this.offsetY=a.top,this.scaleX=(f-b)/b,this.scaleY=(g-c)/c},b.prototype._fadeOutNormalImage=function(){this.$normalFrame.stop(!0,!0).animate({opacity:0},this.zoomOutSpeed)},b.prototype._fadeInNormalImage=function(){this.$normalFrame.stop(!0,!0).animate({opacity:1},this.zoomOutSpeed)},b.prototype._fadeInLargeImage=function(){this.$largeFrame.stop(!0,!0).animate({opacity:1},this.zoomOutSpeed)},c.prototype.load=function(){this._$image.attr("src",this._source+"?"+(new Date).getTime()),this._onStartLoadingEventHandler(this._$image)},c.prototype.setOnStartLoadingEventHandler=function(a){this._onStartLoadingEventHandler=a},c.prototype.setOnFinishLoadingEventHandler=function(a){this._$image.off("load."+j),this._$image.on("load."+j,a)},c.prototype.isLoaded=function(){return this._isLoaded},c.prototype.getWidth=function(){return this._$image.width()},c.prototype.getHeight=function(){return this._$image.height()}}.call(this),function(){var a=this,b=this._,c=a.jQuery,d=a.NR,e=d.resolve("SDM.Core.Components.EventHub");e.EVENTS={TAB_SWITCHED:"TAB_SWITCHED",HEADER_TOOL_CLICKED:"HEADER_TOOL_CLICKED",CLOSE_MOBILE_SBU:"CLOSE_MOBILE_SBU",CLOSE_MOBILE_CAMPAIGN_NAV:"CLOSE_MOBILE_CAMPAIGN_NAV",OPEN_MOBILE_CAMPAIGN_NAV:"OPEN_MOBILE_CAMPAIGN_NAV",USER_INFO_UPDATED:"USER_INFO_UPDATED",ADD_MANAGED_POPUP:"ADD_MANAGED_POPUP",CANCEL_ALL_MANAGED_POPUPS:"CANCEL_ALL_MANAGED_POPUPS",COUPON_LOADED:"COUPON_LOADED",BROOKLYN_OFFERS_ERROR:"BROOKLYN_OFFERS_ERROR",MOBILE_NAV_TOGGLE_CLICK:"MOBILE_NAV_TOGGLE_CLICK",MOBILE_NAV_CLOSE_BUSINESS_UNIT:"MOBILE_NAV_CLOSE_BUSINESS_UNIT",MOBILE_NAV_CLOSE_SUB_BUSINESS_UNIT:"MOBILE_NAV_CLOSE_SUB_BUSINESS_UNIT"},e.ArgumentChekers={TAB_SWITCHED:function(a){return 1===a.length&&"string"==typeof a[0].tabId&&a[0].$button instanceof c&&a[0].$content instanceof c},HEADER_TOOL_CLICKED:function(a){return 2===a.length&&"string"==typeof a[0]&&a[1]instanceof c},CLOSE_MOBILE_SBU:function(a){return 0===a.length},CLOSE_MOBILE_CAMPAIGN_NAV:function(a){return 0===a.length},OPEN_MOBILE_CAMPAIGN_NAV:function(a){return 0===a.length},USER_INFO_UPDATED:function(a){return 0===a.length},ADD_MANAGED_POPUP:function(a){return b.isFunction(a[0].openPopUp)},COUPON_LOADED:function(a){return 0===a.length},BROOKLYN_OFFERS_ERROR:function(a){return 1===a.length&&b.isString(a[0])}}}.call(this),function(){var a=this,b=a._,c=a.Backbone,d=a.NR,e=d.resolve("SDM.Core.Components.EventHub"),f=b.extend({},c.Events);e.subscribe=function(a,b,c){e.EVENTS[a]&&f.on(a,b,c)},e.unsubscribe=function(a,b,c){f.off(a,b,c)},e.fire=function(a){var b,c=e.ArgumentChekers[a];if(e.EVENTS[a]){if(b=Array.prototype.slice.call(arguments,1),c&&!c(b))throw new TypeError("The arguments for "+a+" event are incorrect.");b.unshift(a),f.trigger.apply(f,b)}}}.call(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Mixins"),d=a.jQuery,e=b.resolve("SDM.Util");c.Geolocation={data:function(){return{isGeolocationLoading:!1,geolocationCoordinate:{lat:null,lng:null},postalCode:null,provinceCode:null}},methods:{requestCurrentGeolocationPosition:function(b){if(!navigator.geolocation)return void console.log("Geolocation not supported.");this.isGeolocationLoading=!0,navigator.geolocation.getCurrentPosition(function(c){var f={lat:c.coords.latitude,lng:c.coords.longitude};this.geolocationCoordinate=f,"function"==typeof b&&b(),d.when(e.loadGoogleMapsApi()).then(function(){this.geocoder=new a.google.maps.Geocoder,this.geocoder.geocode({location:f},function(b,c){if(c===a.google.maps.GeocoderStatus.OK&&b&&b.length>0)for(var d=b[0],e=d.address_components,f=0;f this.maxWidthMobile&&this.screenWidth<=this.maxWidthMobileLarge},isTablet:function(){return this.screenWidth>this.maxWidthMobileLarge&&this.screenWidth<=this.maxWidthTablet},isDesktop:function(){return this.screenWidth>this.maxWidthTablet&&this.screenWidth<=this.maxWidthDesktop},isDesktopLarge:function(){return this.screenWidth>this.maxWidthDesktop}},data:function(){return{screenWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),maxWidthMobile:480,maxWidthMobileLarge:640,maxWidthTablet:768,maxWidthDesktop:960}},methods:{onResponsiveResize:function(){this.screenWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0)}},mounted:function(){window.addEventListener("resize",c.debounce(this.onResponsiveResize,100))}}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Stores").Donation={actions:{setActivePanel:function(a,b){a.commit("setActivePanel",b)},setMoneyAmount:function(a,b){a.commit("setMoneyAmount",b)},setPcOptimumAmount:function(a,b){a.commit("setPcOptimumAmount",b)},setAddress:function(a,b){a.commit("setAddress",b)}},mutations:{setActivePanel:function(a,b){a.activePanel=b},setMoneyAmount:function(a,b){a.moneyAmount=b},setPcOptimumAmount:function(a,b){a.pcOptimumAmount=b},setAddress:function(a,b){a.address=b}},namespaced:!0,state:function(){return{activePanel:"",moneyAmount:"",panels:{introduction:"introduction",points:"points",money:"money",pcoptimum:"pcoptimum",confirmation:"confirmation",payer:"payer",completion:"completion"},pcOptimumAmount:"",address:{firstName:"",lastName:"",email:"",address1:"",address2:"",city:"",province:"",postalCode:""}}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Stores"),d=b.resolve("SDM.Util");c.StoreSelector={actions:{setCurrentPaginationNumber:function(a,b){a.commit("setCurrentPaginationNumber",b)},setInventories:function(a,b){a.commit("setInventories",b)},setIsStoreSelectorLoading:function(a,b){a.commit("setIsStoreSelectorLoading",b)},setPopUp:function(a,b){a.commit("setPopUp",b)},setPostalCode:function(a,b){a.commit("setPostalCode",b)},setProductImageUrl:function(a,b){a.commit("setProductImageUrl",b)},setProductHeading:function(a,b){a.commit("setProductHeading",b)},setProductSubheading:function(a,b){a.commit("setProductSubheading",b)},setProductUpc:function(a,b){a.commit("setProductUpc",b)},setSelectedStore:function(a,b){a.commit("setSelectedStore",b)},showPopUp:function(a){a.state.popUp&&a.state.popUp.showPopUp()},setStores:function(a,b){a.commit("setStores",b)}},getters:{selectedProduct:function(a){return""===a.productImageUrl&&""===a.productHeading&&""===a.productSubheading&&""===a.productUpc?null:{imageUrl:a.productImageUrl,heading:a.productHeading,subheading:a.productSubheading,upc:a.productUpc}}},mutations:{setInventories:function(a,b){a.inventories=d.mergeObjects(a.inventories,b)},setCurrentPaginationNumber:function(a,b){a.currentPaginationNumber=b},setIsStoreSelectorLoading:function(a,b){a.isStoreSelectorLoading=b},setPopUp:function(a,b){a.popUp=b},setPostalCode:function(a,b){a.postalCode=b},setProductImageUrl:function(a,b){a.productImageUrl=b},setProductHeading:function(a,b){a.productHeading=b},setProductSubheading:function(a,b){a.productSubheading=b},setProductUpc:function(a,b){a.productUpc=b},setSelectedStore:function(a,b){a.selectedStore=b},setStores:function(a,b){a.stores=b}},namespaced:!0,state:function(){return{currentPaginationNumber:1,inventories:{},isStoreSelectorLoading:!1,popUp:null,postalCode:"",productImageUrl:"",productHeading:"",productSubheading:"",productUpc:"",selectedStore:null,stores:[]}}}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Stores").ProvinceSelector={actions:{setUserProvinceId:function(a,b){a.commit("setUserProvinceId",b)}},getters:{},mutations:{setUserProvinceId:function(a,b){a.userProvinceId=b}},namespaced:!0,state:function(){return{userProvinceId:""}}}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Stores").FindInStore={actions:{setActiveProductListingIndex:function(a,b){a.commit("setActiveProductListingIndex",b)},setListingQuery:function(a,b){a.commit("setListingQuery",b)},setSearchQuery:function(a,b){a.commit("setSearchQuery",b)}},mutations:{setActiveProductListingIndex:function(a,b){a.activeProductListingIndex=b},setListingQuery:function(a,b){a.listingQuery=b},setSearchQuery:function(a,b){a.searchQuery=b}},namespaced:!0,state:function(){return{activeProductListingIndex:1,listingQuery:"",searchQuery:""}}}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Stores").ElasticSearch={actions:{elasticSearch:function(a,b){return a.commit("setElasticQuery",b),a.commit("setIsElasticSearchLoading",!0),new Promise(function(b,c){$.ajax({contentType:"application/json",data:JSON.stringify(a.getters.elasticSearchOptions),dataType:"json",headers:{authorization:"Bearer "+a.state.elasticKey},method:"POST",url:a.getters.elasticEndpoint+"/search"}).done(function(c){c&&(a.commit("setElasticSearchInfo",c.meta),a.commit("setElasticSearchResults",c.results),a.commit("setIsElasticSearchLoading",!0),c.meta&&a.commit("setElasticSearchTotalPage",Math.min(c.meta.page.total_pages,100))),b(c)}.bind(this)).fail(function(a){console.log(a),c(a)}).always(function(){a.commit("setIsElasticSearchLoading",!1)}.bind(this))})},setElasticEndpointBase:function(a,b){a.commit("setElasticEndpointBase",b)},setElasticEngineName:function(a,b){a.commit("setElasticEngineName",b)},setElasticKey:function(a,b){a.commit("setElasticKey",b)},setElasticSearchCurrentPage:function(a,b){a.commit("setElasticSearchCurrentPage",b)},setElasticSearchResultsPerPage:function(a,b){a.commit("setElasticSearchResultsPerPage",b)}},getters:{elasticEndpoint:function(a){return a.elasticEndpointBase+"/api/as/v1/engines/"+a.elasticEngineName},elasticSearchOptions:function(a){return{query:a.elasticQuery,page:{size:a.elasticSearchResultsPerPage,current:a.elasticSearchCurrentPage}}}},mutations:{setElasticEndpointBase:function(a,b){a.elasticEndpointBase=b},setElasticEngineName:function(a,b){a.elasticEngineName=b},setElasticKey:function(a,b){a.elasticKey=b},setIsElasticSearchLoading:function(a,b){a.isElasticSearchLoading=b},setElasticSearchCurrentPage:function(a,b){a.elasticSearchCurrentPage=b},setElasticSearchTotalPage:function(a,b){a.elasticSearchTotalPage=b},setElasticSearchInfo:function(a,b){a.elasticSearchInfo=b},setElasticSearchResults:function(a,b){a.elasticSearchResults=b},setElasticQuery:function(a,b){a.elasticQuery=b},setElasticSearchResultsPerPage:function(a,b){a.elasticSearchResultsPerPage=b}},namespaced:!0,state:function(){return{elasticSearchCurrentPage:1,elasticSearchTotalPage:0,elasticSearchInfo:null,elasticSearchResults:null,isElasticSearchLoading:!1,elasticSearchResultsPerPage:10,elasticEndpointBase:"",elasticEngineName:"",elasticKey:"",elasticQuery:""}}}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Stores").MentalHealthQuiz={actions:{setSelectedModalId:function(a,b){a.commit("setSelectedModalId",b)}},getters:{},mutations:{setSelectedModalId:function(a,b){a.selectedModalId=b}},namespaced:!0,state:function(){return{selectedModalId:""}}}}(this),function(){Vue.directive("click-outside",{bind:function(a,b,c){a.event=function(d){document.body.contains(d.target)&&!a.contains(d.target)&&c.context[b.expression](d)},setTimeout(function(){document.body.addEventListener("click",a.event)},0)},unbind:function(a){document.body.removeEventListener("click",a.event)}})}(),function(a){"use strict";a.NR.resolve("SDM.Vue.Widgets").Tablist={data:function(){return{focusableElementsQuery:'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], [contenteditable]'}},methods:{onKeyDown:function(a){if(!(this.selectedTabIndex<0||this.selectedTabIndex>=this.tabsLength)){var b=this.selectedTabIndex-1%this.tabsLength,c=this.selectedTabIndex+1%this.tabsLength;switch(a.key){case"ArrowLeft":this.$emit("setSelectedTabIndex",b),a.preventDefault();break;case"ArrowRight":this.$emit("setSelectedTabIndex",c),a.preventDefault();break;case"Home":this.$emit("setSelectedTabIndex",0),a.preventDefault();break;case"End":this.$emit("setSelectedTabIndex",this.tabsLength-1),a.preventDefault();break;default:return}Vue.nextTick(function(){this.$refs.tablist.querySelectorAll('[role="tab"]')[this.selectedTabIndex].focus()}.bind(this))}},toggleTabIndex:function(){Vue.nextTick(function(){for(var a=0;a =this.tabsLength?d.tabIndex=0:this.selectedTabIndex===a?(d.tabIndex=0,d.focus()):d.tabIndex=-1}}.bind(this))}},model:{prop:"selectedTabIndex",event:"setSelectedTabIndex"},mounted:function(){this.toggleTabIndex()},props:{tabsLength:{type:Number,default:0},selectedTabIndex:{type:Number,default:-1}},template:"#vue-widget-tablist",watch:{selectedTabIndex:function(a){(a>=0||a 0&&(this.$refs.carousel.hasOwnProperty("slick")&&$(this.$refs.carousel).slick("unslick"),$(this.$refs.carousel).slick({arrows:0!==this.slides.length&&this.isArrowsVisible.desktop,autoplay:this.isAutoplay.desktop,autoplaySpeed:5e3,dots:0!==this.slides.length&&this.isPaginationVisible.desktop,infinite:!1,lazyLoad:"ondemand",responsive:[{breakpoint:this.breakpoints.tablet,settings:{arrows:0!==this.slides.length&&this.isArrowsVisible.tablet,autoplay:this.isAutoplay.tablet,dots:0!==this.slides.length&&this.isPaginationVisible.tablet,slidesToShow:this.slidesToShow.tablet}},{breakpoint:this.breakpoints.mobile,settings:{arrows:0!==this.slides.length&&this.isArrowsVisible.mobile,autoplay:this.isAutoplay.mobile,dots:0!==this.slides.length&&this.isPaginationVisible.mobile,slidesToShow:this.slidesToShow.mobile}}],slidesToScroll:1,slidesToShow:this.slidesToShow.desktop,swipeToSlide:!0}))},checkAvailability:function(a){this.setProductImageUrl(a.image?a.image.url:""),this.setProductHeading(a.title),this.setProductUpc(a.id),this.popUp.showPopUp()}}),components:{"product-tile":d.ProductTile},mixins:[c.Responsive],mounted:function(){ this.initializeCarousel()},props:{slides:{type:Array,default:[]},isArrowsVisible:{type:Object,default:function(){return{desktop:!0,tablet:!0,mobile:!0}}},isAutoplay:{type:Object,default:function(){return{desktop:!1,tablet:!1,mobile:!1}}},isControlsInset:{type:Object,default:function(){return{desktop:!1,tablet:!1,mobile:!1}}},isPaginationVisible:{type:Object,default:function(){return{desktop:!1,tablet:!1,mobile:!1}}},slidesToShow:{type:Object,default:function(){return{desktop:3,tablet:2,mobile:1}}},breakpoints:{type:Object,default:function(){return{tablet:769,mobile:480}}}},template:"#vue-widget-product-carousel",updated:function(){this.initializeCarousel()},watch:{}}}(this,this.jQuery),function(a,b){"use strict";var c=a.NR,d=c.resolve("SDM.Vue.Widgets"),e=c.resolve("SDM.Util"),f=a.moment,g=a.uuidv4,h=c.resolve("SDM.Data.Donation");d.Donation={computed:Object.assign({},Vuex.mapState("donation",["activePanel","moneyAmount","panels","pcOptimumAmount","address"]),{activeStepNumber:function(){if(!0===h.IsLinkOut)switch(this.activePanel){case this.panels.introduction:return 1;case this.panels.points:case this.panels.money:case this.panels.pcoptimum:return 2;case this.panels.confirmation:case this.panels.completion:return 3}else switch(this.activePanel){case this.panels.introduction:case this.panels.points:case this.panels.money:case this.panels.pcoptimum:return 1;case this.panels.address:return 2;case this.panels.confirmation:return 3;case this.panels.completion:return this.selectedDonationType===this.donationTypes.points?2:4}},moneyAmountValue:{get:function(){return this.moneyAmount},set:function(a){this.setMoneyAmount(a)}},numberOfSteps:function(){if(!0===h.IsLinkOut)switch(this.activePanel){case this.panels.introduction:return 0;case this.panels.points:case this.panels.money:case this.panels.pcoptimum:case this.panels.confirmation:return 3;case this.panels.completion:return 4}else switch(this.activePanel){case this.panels.introduction:return 0;case this.panels.points:return 2;case this.panels.money:return 4;case this.panels.pcoptimum:return 2;case this.panels.address:case this.panels.confirmation:return 4;case this.panels.completion:return this.selectedDonationType===this.donationTypes.points?2:4}},isMoneyAmountValid:function(){var a=/^\d*(\.\d{1,2})?$/;return""!==this.moneyAmount&&this.moneyAmount>=parseFloat(h.MinimumMoneyAmount)&&this.moneyAmount.search(a)>=0},isPCOptimumAmountValid:function(){var a=/^[1-9]\d*$/;return""!==this.pcOptimumAmount&&this.pcOptimumAmount>=parseFloat(h.MinimumPointAmount)&&this.pcOptimumAmount.search(a)>=0},pcOptimumAmountValue:{get:function(){return this.pcOptimumAmount},set:function(a){this.setPcOptimumAmount(a)}},addressValue:{get:function(){return this.address},set:function(a){this.setAddress(a)}}}),data:function(){return{donationTypes:{money:"money",points:"points"},formDateTime:f().utc().format("YYYY-MM-DDTHH:mm:ss")+"Z",formReferenceNumber:g(),formTransactionUUID:g(),isLoaderVisible:!1,isPCOptimumErrorVisible:!1,selectedDonationType:"",signature:""}},methods:Object.assign({},Vuex.mapActions("donation",["setActivePanel","setMoneyAmount","setPcOptimumAmount"]),{clearUrlParams:function(){var a="";a=-1===window.location.href.indexOf("?")?window.location.href:window.location.href.slice(0,window.location.href.indexOf("?")),history.pushState&&window.history.pushState("",null,a)},donatePCOptimumPoints:function(){this.isLoaderVisible=!0,b.ajax({context:this,data:{points:this.pcOptimumAmount},method:"POST",url:"/Brooklyn/Donate"}).done(function(a,c){if("success"===c&&"202"===a)this.setActivePanel(this.panels.completion);else{this.isPCOptimumErrorVisible=!0;var d=this.$refs.pcoPointsAmount;e.scrollTo$ElementAsync(b(d),500,this.scrollTopOffset+20),console.log("ERROR:"+a)}}).fail(function(a){this.isPCOptimumErrorVisible=!0;var c=this.$refs.pcoPointsAmount;e.scrollTo$ElementAsync(b(c),500,this.scrollTopOffset+20),console.log(a)}).always(function(){this.isLoaderVisible=!1})},getFormDataAsObject:function(a){for(var c=b(a).serializeArray(),d={},e=0;e 0)for(var b=0;b 0)}},created:function(){this.dropDownElId=this.uniqueIdPrefix+"_DropDown",this.query=this.initialValue},data:function(){return{cachedQuery:"",hasFocus:!1,selectedIndex:-1,query:""}},methods:{clearSuggestions:function(){this.selectedIndex=-1,this.$emit("clear")},decrementSelectedIndex:function(){if(!(this.isLoading||this.suggestions.length<=0)){var a=this.selectedIndex-1;a<-1&&(a=this.suggestions.length-1),this.selectedIndex=a}},focus:function(){this.$refs.input.focus()},incrementSelectedIndex:function(){if(!(this.isLoading||this.suggestions.length<=0)){var a=this.selectedIndex+1;a>this.suggestions.length-1&&(a=-1),this.selectedIndex=a}},makeLinkElId:function(a){return this.uniqueIdPrefix+"_Link_"+String(a)},onFocusChange:function(){setTimeout(_.bind(function(){var a=document.activeElement,b=_.some(this.$el.querySelectorAll("*"),function(b){return b===a});this.setHasFocus(b)},this),50)},onInput:function(){this.selectedIndex=-1,this.cachedQuery=null,this.query.length>2?this.$emit("fetch",this.query):this.clearSuggestions()},onLinkFocus:function(a){this.selectedIndex=a,this.onFocusChange()},onSubmit:function(a){this.query||a.preventDefault();var b=null;this.cachedQuery=this.query,this.selectedIndex>-1&&(b=(this.$refs.suggestionLinks||[])[this.selectedIndex])&&(a.preventDefault(),b.click()),this.clearSuggestions(),this.$emit("submit",a)},setHasFocus:function(a){this.hasFocus=a,this.cachedQuery=this.query}},props:{dropDownClass:{default:"",required:!1,type:String},dropDownTitle:{default:"",required:!1,type:String},formClass:{default:"",required:!1,type:String},initialValue:{default:"",required:!1,type:String},inputClass:{default:"",required:!1,type:String},isLoading:{default:!1,required:!1,type:Boolean},placeholder:{default:"",required:!1,type:String},submitLabel:{default:"",required:!0,type:String},suggestions:{default:function(){return[]},required:!0,type:Array},uniqueIdPrefix:{default:"",required:!0,type:String}},template:"#SearchWithAutocompleteTemplate",watch:{selectedIndex:function(){-1===this.selectedIndex?(this.query=this.cachedQuery||this.query,this.cachedQuery=null):(this.cachedQuery=this.cachedQuery||this.query,this.query=this.suggestions[this.selectedIndex].title)}}})}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Util"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Vue.Stores");d.StoreSelectorModal={components:{"pop-up":d.PopUp},computed:Object.assign({},Vuex.mapGetters("storeSelector",["selectedProduct"]),Vuex.mapState("storeSelector",["currentPaginationNumber","inventories","isStoreSelectorLoading","popUp","postalCode","selectedStore","stores"]),{firstPaginationNumber:function(){return Math.max(1,Math.min(this.currentPaginationNumber-1,this.maxPaginationNumber-2))},secondPaginationNumber:function(){return this.firstPaginationNumber+1},thirdPaginationNumber:function(){return this.firstPaginationNumber+2},maxPaginationNumber:function(){return this.stores.length>0?Math.ceil(this.searchResultCount/this.storesPerPage):1},postalCodeInput:{get:function(){return this.postalCode},set:function(a){this.setPostalCode(a)}},sortedStoreIdsByAvailability:function(){if(!this.selectedProduct)return[];var a={};for(var b in this.inventories)if(this.inventories.hasOwnProperty(b)){var c=this.inventories[b][this.selectedProduct.upc];c&&(a[b]=c)}return Object.keys(a).sort(function(b,c){return a[b]-a[c]})}}),data:function(){return{isRadiusDropdownActive:!1,isStoreSearchEmptyResult:!1,isStoreSearchInvalidPostalCode:!1,isStoreSelectorPopUpVisible:!1,lastSelectedProduct:null,radiusList:[3,5,10,20],searchLatitude:0,searchLongitude:0,selectedRadius:3,searchResultCount:0,storesPerPage:5}},methods:Object.assign({},Vuex.mapActions("storeSelector",["setCurrentPaginationNumber","setIsStoreSelectorLoading","setPopUp","setPostalCode","setSelectedStore","setStores"]),{initGeolocation:function(){var a=this.requrestGeolocation();$.when(a).then(_.bind(function(a){if(a){this.searchLatitude=a.lat,this.searchLongitude=a.lng;var b={latitude:this.searchLatitude,longitude:this.searchLongitude,radius:"3",unit:"km",lang:c.getShortLanguageCode(),lookup:"nearby",rpp:"5",isConsolePreorder:this.isConsolePreorder};this.setIsStoreSelectorLoading(!0),$.when(this.getStores(b)).done(_.bind(function(a){if(a){var b=JSON.parse(a);""===this.postalCodeInput&&b.results.length>0&&(this.postalCodeInput=b.results[0].postalCode,this.setSelectedStore(b.results[0]),sessionStorage.setItem("selected_store_latlng",JSON.stringify({lat:b.results[0].latitude,lng:b.results[0].longitude})),this.setStores(b.results),this.searchResultCount=b.count)}},this)).fail(function(a){console.log(a)}).always(function(){this.setIsStoreSelectorLoading(!1)}.bind(this))}},this))},requrestGeolocation:function(){var a=$.Deferred(),b=JSON.parse(sessionStorage.getItem("selected_store_latlng"));return b?a.resolve(b):navigator.geolocation?navigator.geolocation.getCurrentPosition(function(b){a.resolve({lat:b.coords.latitude,lng:b.coords.longitude})},function(b){console.log(b),a.resolve(null)}):a.resolve(null),a.promise()},onPostalCodeSubmit:function(){this.isRadiusDropdownActive=!1,this.setIsStoreSelectorLoading(!0),c.validatePostalCode(this.postalCodeInput)?(this.isStoreSearchEmptyResult=!1,this.isStoreSearchInvalidPostalCode=!1,$.when(c.loadGoogleMapsApi()).then(_.bind(function(){this.geocoder=new a.google.maps.Geocoder,this.geocoder.geocode({address:this.postalCodeInput},_.bind(this.geocoderCallback,this))},this))):(this.isStoreSearchInvalidPostalCode=!0,this.setIsStoreSelectorLoading(!1))},geocoderCallback:function(b,d){if(d===a.google.maps.GeocoderStatus.OK){var e=b[0].geometry.location;this.setCurrentPaginationNumber(1),this.searchLatitude=e.lat(),this.searchLongitude=e.lng();var f={latitude:e.lat(),longitude:e.lng(),radius:this.selectedRadius,unit:"km",lang:c.getShortLanguageCode(),lookup:"nearby",rpp:this.storesPerPage,productId:this.selectedProduct?this.selectedProduct.upc:null,isConsolePreorder:this.isConsolePreorder};this.setIsStoreSelectorLoading(!0),$.when(this.getStores(f)).done(_.bind(function(a){if(a){var b=JSON.parse(a);b.results.length>0?(this.setStores(b.results),this.searchResultCount=b.count):this.isStoreSearchEmptyResult=!0,this.setIsStoreSelectorLoading(!1),this.lastSelectedProduct=this.selectedProduct}},this)).fail(function(a){console.log(a)}).always(function(){this.setIsStoreSelectorLoading(!1)}.bind(this))}else this.isStoreSearchEmptyResult=!0,this.setIsStoreSelectorLoading(!1)},getInventoryFromStoreNumber:function(a){return this.inventories&&this.inventories[a]&&this.inventories[a][this.selectedProduct.upc]?this.inventories[a][this.selectedProduct.upc]:0},getUrlParametersAsObject:function(a){return JSON.parse('{"'+decodeURI(a).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')},getStores:function(a){return $.ajax({method:"GET",url:"/sdmapi/store/getstores",data:a})},getStoresByIds:function(){$.ajax({method:"GET",url:"/"+c.getShortLanguageCode()+"/store/getstoresbyids",data:{storeids:this.sortedStoreIdsByAvailability.slice((this.currentPaginationNumber-1)*this.storesPerPage,this.storesPerPage).join(",")}}).done(_.bind(function(a){console.log(a)},this)).fail(function(a){console.log(a)})},goToPage:function(a){this.setIsStoreSelectorLoading(!0);var b={isConsolePreorder:this.isConsolePreorder,lang:c.getShortLanguageCode(),latitude:this.searchLatitude,longitude:this.searchLongitude,lookup:"nearby",page:a,productId:this.selectedProduct?this.selectedProduct.upc:null,radius:this.selectedRadius,rpp:this.storesPerPage,unit:"km"};$.when(this.getStores(b)).done(_.bind(function(a){if(a){var b=JSON.parse(a);b.results.length>0?(this.setStores(b.results),this.searchResultCount=b.count):this.isStoreSearchEmptyResult=!0,this.setIsStoreSelectorLoading(!1),this.lastSelectedProduct=this.selectedProduct}},this)).fail(function(a){console.log(a)}).always(function(){this.setIsStoreSelectorLoading(!1)}.bind(this)),this.setCurrentPaginationNumber(a)},registerStoreModule:function(){this.$store.hasModule("storeSelector")||this.$store.registerModule("storeSelector",e.StoreSelector)},selectStore:function(a){this.setSelectedStore(a),sessionStorage.setItem("selected_store_latlng",JSON.stringify({lat:a.latitude,lng:a.longitude})),this.postalCodeInput=a.postalCode,this.popUp.hidePopUp(),this.onPostalCodeSubmit()},setSelectedRadius:function(a){this.selectedRadius=a},sortByDistance:function(){this.setCurrentPaginationNumber(1),this.isSortByInventory=!1,this.onPostalCodeSubmit()},sortByAvailability:function(){this.setCurrentPaginationNumber(1),this.isSortByInventory=!0,this.onPostalCodeSubmit()}}),mounted:function(){this.registerStoreModule(),this.setPopUp(this.$refs.popUpStoreSelector),this.initGeolocation(),""!==this.postalCodeInput&&this.onPostalCodeSubmit()},props:{isConsolePreorder:{type:Boolean,default:!1}},template:"#vue-widget-store-selector-modal",watch:{selectedProduct:function(){this.selectedProduct!==this.lastSelectedProduct&&""!==this.postalCodeInput&&this.onPostalCodeSubmit()}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Widgets"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Mixins");c.StoreSelector={components:{"store-selector-modal":c.StoreSelectorModal},computed:Object.assign({},Vuex.mapState("storeSelector",["popUp","selectedStore"]),{}),data:function(){return{isStoreInfoVisible:!1}},methods:Object.assign({},Vuex.mapActions("storeSelector",["setProductImageUrl","setProductHeading","setProductSubheading","setProductUpc","setSelectedStore"]),{hideStoreInfo:function(){this.isStoreInfoVisible=!1},onSelectStoreClick:function(){this.setProductImageUrl(""),this.setProductHeading(""),this.setProductSubheading(""),this.setProductUpc(""),this.popUp.showPopUp()},registerStoreModule:function(){this.$store.hasModule("storeSelector")||this.$store.registerModule("storeSelector",d.StoreSelector)}}),mixins:[e.Responsive],mounted:function(){this.registerStoreModule()},props:{colorPrimary:{type:String,default:""},colorSecondary:{type:String,default:""},isMinimalOnMobile:{type:Boolean,default:!1},icon:{type:String,default:"/static/core/images/icon-pin-small.png"}},template:"#vue-widget-store-selector"}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Widgets"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Mixins"),f=b.resolve("SDM.Util");c.ProvinceSelector={created:function(){document.addEventListener("click",function(a){this.$refs.refProvinceSelector&&!this.$refs.refProvinceSelector.contains(a.target)&&(this.isProvinceSelectorActive=!1)}.bind(this))},components:{},computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"])),data:function(){return{isProvinceSelectorActive:!1,pronviceFromApi:""}},methods:Object.assign({},Vuex.mapActions("provinceSelector",["setUserProvinceId"]),{registerStoreModule:function(){this.$store.hasModule("provinceSelector")||this.$store.registerModule("provinceSelector",d.provinceSelector)}, selectUserProvinceId:function(a){f.saveCookie("user-selected-province-id",a),this.isProvinceSelectorActive=!1,this.model.provinceSelectorSettings&&this.model.provinceSelectorSettings.refreshPageOnSelect?location.reload(!0):this.setUserProvinceId(a)},initGeolocation:function(){var a=JSON.parse(sessionStorage.getItem("current-geolocation"));if(a&&Object.keys(a).length>0)this.searchProvinceId(a);else{var b=this.requrestGeolocation();$.when(b).then(_.bind(function(a){if(a){var b={lat:a.lat,lng:a.lng};sessionStorage.setItem("current-geolocation",JSON.stringify(b)),this.searchProvinceId(b)}},this))}},searchProvinceId:function(b){$.when(f.loadGoogleMapsApi()).done(function(){this.geocoder=new a.google.maps.Geocoder,this.geocoder.geocode({location:b},_.bind(this.geocoderCallback,this))}.bind(this)).fail(function(){this.setSdmLocation()}.bind(this))},requrestGeolocation:function(){var a=this,b=$.Deferred();return navigator.geolocation?navigator.geolocation.getCurrentPosition(function(a){b.resolve({lat:a.coords.latitude,lng:a.coords.longitude})},function(){a.setSdmLocation(),b.resolve(null)}):b.resolve(null),b.promise()},geocoderCallback:function(b,c){var d=this;if(c===a.google.maps.GeocoderStatus.OK){b[0].address_components.map(function(a){a.types.includes("administrative_area_level_1")&&(d.pronviceFromApi=a.short_name)});-1!==this.model.provinces.findIndex(function(a){return a.abbreviation.toUpperCase()===this.pronviceFromApi}.bind(this))?this.setUserProvinceId(this.pronviceFromApi):this.setSdmLocation()}},setSdmLocation:function(){var a=-1!==this.model.provinces.findIndex(function(a){return a.abbreviation.toUpperCase()===this.userProvinceId.toUpperCase()}.bind(this)),b=-1!==this.model.provinces.findIndex(function(a){return"ON"===a.abbreviation.toUpperCase()}.bind(this)),c=-1!==this.model.provinces.findIndex(function(a){return"QC"===a.abbreviation.toUpperCase()}.bind(this));a||(f.isPhx()&&c?this.setUserProvinceId("QC"):!f.isPhx()&&b?this.setUserProvinceId("ON"):this.setUserProvinceId(this.provinces[0].abbreviation.toUpperCase()))}}),mixins:[e.Responsive],mounted:function(){if(this.registerStoreModule(),this.model.provinces){this.setSdmLocation();var a=f.getValueFromCookie("user-selected-province-id");a?(this.setUserProvinceId(a.toUpperCase()),this.setSdmLocation()):this.initGeolocation()}},props:{model:{type:Object,required:!0}},template:"#vue-widget-province-selector"}}(this),function(a){var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Widgets"),f=b.resolve("SDM.Data.Apple");c.Apple=function(){var a=new Vuex.Store({modules:{storeSelector:d.StoreSelector}}),b={methods:{findObjectByKey:function(a,b,c){for(var d=0;d 640?(this.isMenuOpen=!1,TweenLite.to(this.navigationContainer,.3,{height:"68px"})):(this.isMenuOpen=!1,TweenLite.to(this.navigationContainer,.3,{height:"62px"}))}},watch:{$route:function(){this.isMenuOpen=!1,window.innerWidth<641&&TweenLite.to(this.navigationContainer,.3,{height:"59px"})}}});var h={template:"#module-apple-home-template",mounted:function(){this.$el.style.opacity=0,TweenLite.to(this.$el,.5,{opacity:1,delay:.6})}},i={template:"#module-apple-products-grid-template",mixins:[b],props:{discoverMore:String},data:function(){return{productsArrayData:[],productsArray:[]}},mounted:function(){this.productsArrayData=this.findObjectByKey(f.Tabs,"TabFriendlyUrlName",this.$route.fullPath.split("/")[1]).Products,this.initProductsArrayData()},methods:Object.assign({},Vuex.mapActions("storeSelector",["setInventories","setProductImageUrl","setProductHeading","setProductSubheading","setProductUpc"]),{initProductsArrayData:function(){for(var a=0;a 0&&(this.productImages=this.productData.Assets),this.initProductData()},methods:Object.assign({},Vuex.mapActions("storeSelector",["setProductImageUrl","setProductHeading","setProductSubheading","setProductUpc"]),{initProductData:function(){this.productImages.length>0?(this.currentImage=this.productImages[this.currentImageIndex],this.product.imageSrc=this.productImages[0].Url):(this.currentImage="",this.product.imageSrc=""),this.product.id=this.productData.UpcStripped,this.product.title=this.productData.Content.Title,this.product.subTitle=this.productData.Content.SupplementTitleText,this.product.upc=this.productData.UpcStripped,this.productBuyNowLink=this.productData.BuyNowLink,this.product.description=this.productData.Content.Description},thumbnailClick:function(a){this.currentImageIndex=a,this.currentImage=this.productImages[this.currentImageIndex]},checkAvailability:function(a){this.setProductImageUrl(a.imageSrc),this.setProductHeading(a.title),this.setProductUpc(a.upc),this.popUp.showPopUp()}}),computed:Object.assign({},Vuex.mapState("storeSelector",["inventories","popUp","selectedStore"]))};Vue.component("products-grid",i),Vue.component("product-details",j),Vue.component("store-selector",e.StoreSelector);for(var k=[{path:"/",components:{mainContent:h}}],l=0;l k}},created:function(){var a=97,b=a+26;this.debouncedFetchSuggestions=d.debounce(this.fetchSuggestions,500),this.conditionsByChar=d.reduce(g.Conditions,function(a,b){return a[b.key]=b.conditions,a},{}),this.filterChars=d.map(d.range(a,b),function(a){return String.fromCodePoint(a)})},data:function(){return{currentSuggestionsRequest:null,filterChar:null,isLoadingSuggestions:!1,isShowFilteredConditions:!1,searchSuggestions:[]}},el:a.get(0),methods:{cancelSuggestionsRequest:function(){this.currentRequest&&this.currentRequest.abort&&(this.currentRequest.abort(),this.isLoadingSuggestions=!1)},fetchSuggestions:function(a){a.length&&(this.cancelSuggestionsRequest(),this.isLoadingSuggestions=!0,this.currentRequest=c.ajax({type:"GET",url:"/"+i.getShortLanguageCode()+"/search/getstructuredsearch",data:{numRes:15,query:a,type:"Condition"},success:d.bind(function(a){this.isLoadingSuggestions=!1,this.searchSuggestions=d.map(a.StructuredResult[0].Result.records.page,function(a){return{title:a.title,url:a.url}})},this)}))},onClearSearch:function(){this.searchSuggestions=[],this.cancelSuggestionsRequest()},setFilterChar:function(a){this.isShowFilteredConditions=!1,this.filterChar=a},showFilteredConditions:function(){this.isShowFilteredConditions=!0}}})}}(this),function(a){var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Data.ConsolePreorderBanner");c.ConsolePreorderBanner=function(){new Vue({data:function(){return{isLoading:!0,isSoldOut:!0}},el:"#module-console-preorder-banner",mounted:function(){this.isLoading=!0,$.ajax({contentType:"application/json",data:JSON.stringify({Brand:d.Brand}),dataType:"json",headers:{__RequestVerificationToken:d.VerificationToken},method:"POST",url:"/consolepreorder/GetPreorderStock"}).done(function(a){var b=a;Object.keys(b).forEach(function(a){b[a]&&(this.isSoldOut=!1)}.bind(this))}.bind(this)).fail(function(a){console.log(a)}).always(function(){this.isLoading=!1}.bind(this))}})}}(this),function(a){a.NR.resolve("SDM.Vue.Modules.ConsolePreorder.VueComponents").ProgressBar={name:"ProgressBar",props:{currentStep:{type:Number,default:1},totalSteps:{type:Number,default:4}},template:"#module-console-preorder-progress-bar"}}(this),function(a,b){var c=a.NR,d=c.resolve("SDM.Vue.Modules.ConsolePreorder.VueComponents"),e=c.resolve("SDM.Util"),f=c.resolve("SDM.Vue.Widgets"),g=c.resolve("SDM.Data.ConsolePreorder");d.Reservation={components:{"pop-up":f.PopUp,"progress-bar":d.ProgressBar,"store-selector-modal":f.StoreSelectorModal},computed:Object.assign({},Vuex.mapState("storeSelector",["popUp","postalCode","selectedStore"]),{cartLength:function(){return Object.keys(this.cart).length},postalCodeInput:{get:function(){return this.postalCode},set:function(a){this.setPostalCode(a)}},totalProductPrice:function(){var a=0,b=e.getShortLanguageCode(),c=Object.keys(this.cart);for(var d in c){var f=c[d];a+=parseFloat(this.cart[f])}var g=a.toFixed(2).split("."),h=g[0],i=g[1];return"en"===b?"$"+(h=h.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"))+"."+i:"fr"===b?(h=h.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1 "))+","+i+" $":void 0}}),data:function(){return{cart:{},cartOutOfStock:{},consentConsole:!1,consentNewsletter:!1,currentStep:1,email:"",firstName:"",isLoading:!1,isNotificationSubscribed:!1,lastName:"",selectedConsole:"",selectedProductDetailKey:"",selectedProductNotificationKey:"",stockAvailability:{},totalSteps:4}},methods:Object.assign({},Vuex.mapActions("storeSelector",["setPostalCode"]),{checkConsoleConsent:function(){this.consentConsole?this.$refs.formConsoleConsent.setCustomValidity(""):this.$refs.formConsoleConsent.setCustomValidity(g.ConsentCheckboxErrorMessage)},checkEmail:function(){e.validateEmail(this.email)?(this.$refs.formEmail&&this.$refs.formEmail.setCustomValidity(""),this.$refs.formStockNotificationEmail&&this.$refs.formStockNotificationEmail.setCustomValidity(""),this.$refs.formProductNotificationEmail&&this.$refs.formProductNotificationEmail.setCustomValidity("")):(this.$refs.formEmail&&this.$refs.formEmail.setCustomValidity(g.EmailErrorMessage),this.$refs.formStockNotificationEmail&&this.$refs.formStockNotificationEmail.setCustomValidity(g.EmailErrorMessage),this.$refs.formProductNotificationEmail&&this.$refs.formProductNotificationEmail.setCustomValidity(g.EmailErrorMessage))},checkFirstName:function(){""===this.firstName?this.$refs.formFirstName.setCustomValidity(g.FirstNameErrorMessage):this.$refs.formFirstName.setCustomValidity("")},checkLastName:function(){""===this.lastName?this.$refs.formLastName.setCustomValidity(g.LastNameErrorMessage):this.$refs.formLastName.setCustomValidity("")},checkPostalCode:function(){return e.validatePostalCode(this.postalCodeInput)?(this.$refs.formPostalCode.setCustomValidity(""),!0):(this.$refs.formPostalCode.setCustomValidity(g.PostalCodeErrorMessage),!1)},closeUsedEmailPopUp:function(){this.$refs.popUpUsedEmail.hidePopUp()},getStockStatus:function(){b.ajax({contentType:"application/json",data:JSON.stringify({Brand:g.Brand}),dataType:"json",headers:{__RequestVerificationToken:g.VerificationToken},method:"POST",url:"/consolepreorder/GetPreorderStock"}).done(function(a){this.stockAvailability=a}.bind(this)).fail(function(a){console.log(a)}).always(function(){this.isLoading=!1}.bind(this))},goBack:function(){1===this.currentStep?this.$router.go(-1):this.currentStep-=1,e.scrollTo$ElementAsync(b(this.$refs.reservation),500)},proceedFromStepOne:function(){this.currentStep+=1,e.scrollTo$ElementAsync(b(this.$refs.reservation),500)},proceedFromStepTwo:function(){this.$refs.popUpStock.hidePopUp(),this.checkConsoleConsent(),this.checkEmail(),this.checkFirstName(),this.checkLastName(),this.$refs.formPickup.checkValidity()?(this.consentNewsletter&&this.subscribeNewsletter(),this.sendPreorder()):this.$refs.formPickup.reportValidity()},searchStore:function(){this.$refs.formStoreSelector&&!this.$refs.formStoreSelector.checkValidity()?this.$refs.formStoreSelector.reportValidity():(this.popUp.showPopUp(),this.$refs.storeSelectorModal.onPostalCodeSubmit())},sendPreorder:function(){this.isLoading=!0;var a={Brand:g.Brand,Email:this.email,FirstName:this.firstName,LastName:this.lastName,CASLValue:g.CASLValue,LangCode:e.getFullLanguageCode(),IsSDM:g.IsSDM,SdmPromotion:this.consentNewsletter,StoreID:this.selectedStore.storeNumber};Object.keys(this.cart).forEach(function(b){a[b]=!0}),b.ajax({contentType:"application/json",data:JSON.stringify(a),dataType:"json",headers:{__RequestVerificationToken:g.VerificationToken},method:"POST",url:"/consolepreorder/preorder"}).done(function(a){"OK"===a.Status&&"Queued"===a.Message?(this.currentStep+=1,e.scrollTo$ElementAsync(b(this.$refs.reservation),500)):"FAIL"===a.Status&&"Confirmed"===a.Message?this.$refs.popUpUsedEmail.showPopUp():"FAIL"===a.Status&&"PendingValidation"===a.Message?this.$refs.popUpPendingEmail.showPopUp():"FAIL"===a.Status&&"OutOfStock"===a.Message&&(this.cartOutOfStock=[],Object.keys(this.cart).forEach(function(b){!1===a.Stock[b]&&(this.selectedConsole===b&&(this.selectedConsole=""),this.$set(this.cartOutOfStock,b,this.cart[b]),this.$delete(this.cart,b))}.bind(this)),this.stockAvailability=a.Stock,this.isNotificationSubscribed=!1,this.$refs.popUpStock.showPopUp(),0===this.cartLength&&this.goBack())}.bind(this)).fail(function(a){console.log(a)}).always(function(){this.isLoading=!1}.bind(this))},showProductDetail:function(a){this.selectedProductDetailKey=a,this.$refs.popUpProductDetail.showPopUp()},showProductNotification:function(a){this.isNotificationSubscribed=!1,this.selectedProductNotificationKey=a,this.$refs.popUpProductNotification.showPopUp()},subscribeNewsletter:function(){b.ajax({context:this,cache:!1,contentType:"application/x-www-form-urlencoded",type:"POST",url:"/subscribe",data:{email:this.email,casl:""},headers:{__RequestVerificationToken:g.VerificationToken}}).done(function(a){"True"!==a&&console.log(err)}).fail(function(a){console.log(a)})},subscribeNotification:function(a){this.isLoading=!0;var c={Brand:g.Brand,Email:this.email,CASLValue:g.CASLValue,LangCode:e.getFullLanguageCode(),IsSDM:g.IsSDM};a.forEach(function(a){c[a]=!0}),b.ajax({contentType:"application/json",data:JSON.stringify(c),dataType:"json",headers:{__RequestVerificationToken:g.VerificationToken},method:"POST",url:"/consolepreorder/subscribe"}).done(function(a){"OK"===a.Status&&"Queued"===a.Message&&(this.isNotificationSubscribed=!0)}.bind(this)).fail(function(a){console.log(a)}).always(function(){this.isLoading=!1}.bind(this))},subscribeOutOfStockCart:function(){if(this.$refs.formStockNotification&&!this.$refs.formStockNotification.checkValidity())this.$refs.formStockNotification.reportValidity();else{var a=Object.keys(this.cartOutOfStock);this.subscribeNotification(a)}},subscribeProductNotification:function(){if(this.$refs.formProductNotification&&!this.$refs.formProductNotification.checkValidity())this.$refs.formProductNotification.reportValidity();else{var a=[];a.push(selectedProductNotificationKey),this.subscribeNotification(a)}},toggleConsole:function(a,b){""===this.selectedConsole?(this.selectedConsole=a,this.toggleProductInCart(a,b)):this.selectedConsole!==a?(this.toggleProductInCart(this.selectedConsole,this.cart[this.selectedConsole]),this.toggleProductInCart(a,b),this.selectedConsole=a):(this.selectedConsole="",this.toggleProductInCart(a,b))},toggleProductInCart:function(a,b){void 0===this.cart[a]?this.$set(this.cart,a,b):this.$delete(this.cart,a),0===Object.keys(this.cart).length&&1!==this.currentStep&&this.goBack()}}),mounted:function(){this.isLoading=!0,this.getStockStatus();var a=parseInt(g.StockCheckFrequency);a>=0&&setInterval(function(){this.getStockStatus()}.bind(this),a)},name:"Reservation",template:"#module-console-preorder-reservation"}}(this,this.jQuery),function(a){a.NR.resolve("SDM.Vue.Modules.ConsolePreorder.VueComponents").Update={mounted:function(){},name:"Update",template:"#module-console-preorder-update"}}(this),function(a,b){var c=a.NR,d=c.resolve("SDM.Vue.Modules"),e=c.resolve("SDM.Vue.Modules.ConsolePreorder.VueComponents"),f=c.resolve("SDM.Vue.Stores");d.ConsolePreorder=function(){var a=new Vuex.Store({modules:{storeSelector:f.StoreSelector,consolePreorder:{}}}),c=new VueRouter({base:b("#module-console-preorder").data("module-console-preorder-base"),mode:"history",routes:[{component:e.Reservation,name:"reservation",path:"/"},{component:e.Update,name:"update",path:"/update"}]});new Vue({el:"#module-console-preorder",mounted:function(){},router:c,store:a})}}(this,this.jQuery),function(a){a.NR.resolve("SDM.Vue.Modules").FaqSection=function(a){new Vue({data:function(){return{openIndex:-1}},el:a.get(0),methods:{closeItem:function(a,b){function c(){var f=parseInt(a.style.maxHeight,10),g=f+e;e*=.95,a.style.maxHeight=String(Math.max(0,g))+"px",g>0?window.requestAnimationFrame(c):(a.style.maxHeight=String(d)+"px",b())}var d=a.offsetHeight,e=0-a.offsetHeight/15;a.style.maxHeight=d+"px",window.requestAnimationFrame(c)},openItem:function(a,b){function c(){var f=parseInt(a.style.maxHeight,10),g=f+e;e*=.95,a.style.maxHeight=String(g)+"px",g 0,c=h.getUrlVars();this.isUserProvinceIdAvailable&&c&&"true"===c.book&&!a&&(delete c.book,h.setUrlVars(c),this.showPopUp())},onBackClick:function(){this.isSubmissionCompleted=!1,this.isSubmissionFailed=!1},onSubmitBookingClick:function(a){this.$refs.formAppointment.checkValidity()?(this.isLoading=!0,b.ajax({data:{FirstName:this.formFirstName,LastName:this.formLastName,PhoneNumber:this.formPhoneNumber,EmailAddress:this.formEmail,Province:this.formProvince,PreferredLanguage:this.formLanguage,LangCode:i.LanguageCode},headers:{__RequestVerificationToken:i.AntiForgeryToken},method:"POST",url:"/dietitian/SubmitBooking"}).done(function(a){a&&202===a.StatusCode?this.isSubmissionCompleted=!0:this.isSubmissionFailed=!0}.bind(this)).fail(function(a){console.log(a),this.isSubmissionFailed=!0}).always(function(){this.isLoading=!1}.bind(this))):(this.isInvalidSymbolVisible=!0,this.$refs.formAppointment.reportValidity()),a.preventDefault()},onOkClick:function(){this.$refs.popUpBookAppointment.hidePopUp()},showPopUp:function(){this.formEmail="",this.formFirstName="",this.formLanguage="",this.formLastName="",this.formPhoneNumber="",this.formProvince="",this.isSubmissionCompleted=!1,this.isSubmissionFailed=!1,this.isInvalidSymbolVisible=!1,this.$refs.popUpBookAppointment.showPopUp()}},mounted:function(){this.provinces=i.Provinces.map(function(a){return{abbreviation:a.Abbreviation.toUpperCase(),title:a.Title}}),this.handleUrlParam()},store:j})}}(this,jQuery),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Widgets"),f=b.resolve("SDM.Util");c.FindInStore=function(a){var c=a.data("contentId"),g=b.resolve("SDM.Data.FindInStore")[c],h=new Vuex.Store({modules:{elasticSearch:d.ElasticSearch,storeSelector:d.StoreSelector,findInStore:d.FindInStore}}),i=new VueRouter({base:"/"+f.getShortLanguageCode()+"/find-in-store/",mode:"history",routes:[{component:e.FindInStoreListing,name:"listing",path:"/",props:{powerReviewsApiKey:g.PowerReviewsApiKey,powerReviewsMerchantId:g.PowerReviewsMerchantId,powerReviewsMerchantGroupId:g.PowerReviewsMerchantGroupId,powerReviewsLocale:g.PowerReviewsLocale}},{component:e.FindInStoreProduct,name:"product",path:"/product/:titleSlug/:upc",props:{elasticEndpointBase:g.ElasticEndpointBase,elasticEngineName:g.ElasticEngineName,elasticKey:g.ElasticKey,isCompactStyle:g.IsProductDetailsCompactStyle}}]});new Vue({components:{"find-in-store-search":e.FindInStoreSearch,"store-selector":e.StoreSelector},computed:Object.assign({},{}),data:function(){return{}},el:a[0],methods:Object.assign({},{}),mounted:function(){},router:i,store:h})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Mixins"),d=b.resolve("SDM.Vue.Modules"),e=b.resolve("SDM.Vue.Widgets"),f=b.resolve("SDM.Vue.Stores");d.LoveYouDonation=function(){var a=new Vuex.Store({modules:{donation:f.Donation}});new Vue({components:{donation:e.Donation},el:"#module-love-you-donation",mixins:[c.Responsive],store:a})}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.P32021.VueComponents").BadgeCta={computed:{},data:function(){return{}},methods:{},mounted:function(){},props:{badge:{type:Object,default:null}},template:"#module-p3-2021-badge-cta",updated:function(){},watch:{}}}(this,this.jQuery),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.P32021.VueComponents").FooterMenu={computed:{},data:function(){return{}},methods:{},mounted:function(){},props:{},template:"#module-p3-2021-footer",updated:function(){},watch:{}}}(this,this.jQuery),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.P32021.VueComponents"),d=b.resolve("SDM.Util");c.GameSelector={computed:{},data:function(){return{}},methods:Object.assign({},Vuex.mapActions("p32021",["setGameScore","setIsGameCompleted"]),{resetCookie:function(){this.setGameScore(0),this.setIsGameCompleted(!1),d.saveCookie("p32021game","{}")}}),mounted:function(){},props:{heading:{type:String,default:""},productImages:{type:Array,default:function(){return[]}},cta:{type:Object,default:null}},template:"#module-p3-2021-game-selector",updated:function(){},watch:{}}}(this,this.jQuery),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.P32021.VueComponents"),d=b.resolve("SDM.Data.P32021");c.Game={computed:Object.assign({},Vuex.mapState("p32021",["gameScore","isGameCompleted"]),{}),data:function(){return{gamePieceLayer:null,playfieldLayer:null,productsLayer:null,gameOverLayer:null,indicatorLayer:null,world:null,gamePieces:[],pegs:[],width:480,height:640,scale:40,radiusDisk:.65,colors:[],defaultFillColor:null,specialFillColor:null,defaultStrokeColor:null,specialStrokeColor:null,drawDebugData:!1,addStats:!1,pointTextObject:null,currentPlayerPoints:0,ballsLeftInitial:3,ballsLeft:3,indicatorGamePiece:null,assets:{},target:1,locale:"en",tl:"",Util:{},SfxInterface:"",selectedGoalProduct:0,products:{}}},methods:Object.assign({},Vuex.mapActions("p32021",["setGameScore","setIsGameCompleted"]),{initDropToWinGame:function(){var a=this;this.ballsLeft=this.gameChances,this.setImageAssets(this.products);var b=0,c={containerId:"canvasContainer",layers:[{name:"canvasDropToWinBackground",x:0,y:0,width:480,height:640,zIndex:b++,backgroundColor:"#aa1651"},{name:"canvasDropToWinProducts",x:0,y:0,width:480,height:640,zIndex:b++},{name:"canvasDropToWinPlayfield",x:0,y:0,width:480,height:640,zIndex:b++},{name:"canvasDropToWinGamePieceLayer",x:0,y:0,width:480,height:640,zIndex:b++},{name:"canvasDropToWinBox2dDebug",x:0,y:0,width:480,height:640,zIndex:b++},{name:"canvasDropToWinIndicatorLayer",x:0,y:0,width:480,height:640,zIndex:b++},{name:"canvasDropToWinMouseHit",x:0,y:0,width:480,height:640,zIndex:b++,clickCallback:a.onGameStart,mouseHitId:"canvasMouseHitDetector"}]};if(document.StratiscapeDraw=new Stratiscape(c),document.StratiscapeDraw.canvasSupported){var d=document.StratiscapeDraw.getLayer("canvasDropToWinPlayfield"),e=document.StratiscapeDraw.getLayer("canvasDropToWinGamePieceLayer"),f=document.StratiscapeDraw.getLayer("canvasDropToWinBackground"),g=document.StratiscapeDraw.getLayer("canvasDropToWinBox2dDebug"),h=document.StratiscapeDraw.getLayer("canvasDropToWinProducts"),i=document.StratiscapeDraw.getLayer("canvasDropToWinIndicatorLayer");this.Setup("en",d,e,f,g,h,i)}else $("#canvasContainer").html(' Bummer! Your browser does not support the HTML 5 Canvas Tag!
');this.WinnerText=new this.WinnerText(a.width/2,a.height/2,a.winnerTextUrl),this.indicatorLayer.addChild(a.WinnerText),this.setTarget(a.selectedGoalProduct),this.updateAllImages()},handleKeyDown:function(a){this&&this.$el&&window.document.contains(this.$el)&&32===a.keyCode&&(a.preventDefault(),this.onGameStart())},setScore:function(a){a>=0&&a<=5&&this.setGameScore(this.gameScore+a)},gameOver:function(){this.setIsGameCompleted(!0)},setImageAssets:function(a){this.assets=a},getImageAsset:function(a){return this.assets[a]},Setup:function(a,b,c,d,e,f,g){this.locale=a;var h=this;this.SfxInterface=new SfxInterface(["/static/core/sounds/p3-2021/WoodBlHiExtraPercV1.wav","/static/core/sounds/p3-2021/WoodBlHiExtraPercV2.wav","/static/core/sounds/p3-2021/WoodBlHiExtraPercV3.wav","/static/core/sounds/p3-2021/WoodBlHiOrchPercV1.wav","/static/core/sounds/p3-2021/points.wav","/static/core/sounds/p3-2021/VibraSlapExtraPercV1.wav","/static/core/sounds/p3-2021/highpoints.wav","/static/core/sounds/p3-2021/winner.mp3","/static/core/sounds/p3-2021/ClaveMetamorphic.wav"]),this.SfxInterface.setVolume(.5),this.SfxInterface.setVolumeAt(0,.1),this.SfxInterface.setVolumeAt(1,.1),this.SfxInterface.setVolumeAt(2,.1),this.SfxInterface.setVolumeAt(3,.2),this.colors.push(new h.Util.ColorRGBA(255,255,255,255)),this.colors.push(new h.Util.ColorRGBA(255,255,0,255)),this.colors.push(new h.Util.ColorRGBA(255,165,0,255)),this.colors.push(new h.Util.ColorRGBA(0,0,255,255)),this.colors.push(new h.Util.ColorRGBA(0,128,0,255)),this.colors.push(new h.Util.ColorRGBA(255,0,0,255)),this.colors.push(new h.Util.ColorRGBA(128,0,128,255)),this.defaultFillColor=new h.Util.ColorRGBA(163,23,79,255),this.specialFillColor=new h.Util.ColorRGBA(246,0,255,255),this.defaultStrokeColor=new h.Util.ColorRGBA(251,219,99,255),this.specialStrokeColor=new h.Util.ColorRGBA(22,44,12,255);var i=.1,j=this.width/this.scale,k=this.height/this.scale,l=k-i,m=Box2D.Common.Math.b2Vec2,n=Box2D.Dynamics.b2BodyDef,o=Box2D.Dynamics.b2FixtureDef,p=Box2D.Dynamics.b2World,q=Box2D.Collision.Shapes.b2PolygonShape,r=Box2D.Collision.Shapes.b2CircleShape,s=Box2D.Dynamics.b2DebugDraw,t=new o;t.density=1,t.friction=.1,t.restitution=.1;var u=new n;this.world=new p(new m(0,30),!0),this.playfieldLayer=b,this.gamePieceLayer=c,this.productsLayer=f,this.backgroundLayer=d,this.indicatorLayer=g;var v=new Box2D.Dynamics.b2ContactListener;v.BeginContact=function(a){var b=null,c=null,d=a.m_nodeA.other.GetUserData(),e=a.m_nodeB.other.GetUserData();if(d&&(d instanceof h.GamePiece?c=d:b=d),e&&(e instanceof h.GamePiece?c=e:b=e),b)if(b instanceof h.Peg){var f=new h.Util.ColorRGBA(246,218,106,255);b.highlight(!0,f),c.onHit(),h.SfxInterface.playFileAt(h.Util.NextRandom(0,3))}else h.SfxInterface.playFileAt(8);else if((void 0!==a.m_nodeA.other.pointValue||void 0!==a.m_nodeB.other.pointValue)&&!c.scored){c.body.SetAngularVelocity(0), c.body.SetLinearVelocity({x:0,y:0}),c.body.IsAwake(!1),c.scored=!0;var g=null;g=void 0!==a.m_nodeA.other.pointValue?a.m_nodeA.other:a.m_nodeB.other,h.onScoreEvent(g)}},this.world.SetContactListener(v),u.position.x=0,u.position.y=-.05,t.shape=new Box2D.Collision.Shapes.b2PolygonShape,t.shape.SetAsBox(j,.05),this.world.CreateBody(u).CreateFixture(t),u.position.x=-.7,u.position.y=k/2,t.shape=new Box2D.Collision.Shapes.b2PolygonShape,t.shape.SetAsBox(.05,k/2),this.world.CreateBody(u).CreateFixture(t),u.position.x=j+.7,t.shape=new Box2D.Collision.Shapes.b2PolygonShape,t.shape.SetAsBox(.05,k/2),this.world.CreateBody(u).CreateFixture(t);var w=-.9,x=new o;x.shape=new Box2D.Collision.Shapes.b2PolygonShape,x.density=.1,x.friction=.1,x.restitution=.98,u.position.x=-1.1,u.position.y=w+3.5;var y=[];y.push(new m(1,0)),y.push(new m(2,1)),y.push(new m(1,2)),y.push(new m(0,1)),x.shape.SetAsArray(y,0);var z=this.world.CreateBody(u),A=new this.Polygon(u.position.x,u.position.y,y);z.SetUserData(A),z.CreateFixture(x),b.addChild(A),u.position.x=-1.1,u.position.y=w+9.5,y=[],y.push(new m(1,0)),y.push(new m(2,1)),y.push(new m(1,2)),y.push(new m(0,1)),x.shape.SetAsArray(y,0),z=this.world.CreateBody(u),A=new this.Polygon(u.position.x,u.position.y,y),z.SetUserData(A),z.CreateFixture(x),b.addChild(A),u.position.x=j-.9,u.position.y=w+3.5,y=[],y.push(new m(1,0)),y.push(new m(2,1)),y.push(new m(1,2)),y.push(new m(0,1)),x.shape.SetAsArray(y,0),z=this.world.CreateBody(u),A=new this.Polygon(u.position.x,u.position.y,y),z.SetUserData(A),z.CreateFixture(x),b.addChild(A),u.position.x=j-.9,u.position.y=w+9.5,y=[],y.push(new m(1,0)),y.push(new m(2,1)),y.push(new m(1,2)),y.push(new m(0,1)),x.shape.SetAsArray(y,0),z=this.world.CreateBody(u),A=new this.Polygon(u.position.x,u.position.y,y),z.SetUserData(A),z.CreateFixture(x),b.addChild(A),this.pegs=[],this.pegArrays=[];var B,C=.15,D=2*C,E=0,F=1,G=.9,H=.1,I=[],J=4,K=2.25,L=w+3,M=j-2,N=M/J;I=[];for(var O=0;O0))return void console.log("GAME OVER");if(this.gamePieceLayer&&0===this.gamePieceLayer.children.length&&0===this.gamePieces.length){this.ballsLeft--,this.IndicatorGamePiece.hide(),this.resetPegs();var b=this.IndicatorGamePiece.x,c=this.IndicatorGamePiece.y,d=new Box2D.Dynamics.b2FixtureDef,e=new Box2D.Dynamics.b2BodyDef;d.friction=.9,d.density=1,d.restitution=.9,e.type=Box2D.Dynamics.b2Body.b2_dynamicBody,d.shape=new Box2D.Collision.Shapes.b2CircleShape(this.radiusDisk),e.position.x=b/this.scale,e.position.y=c/this.scale;var f=this.world.CreateBody(e),g=new this.GamePiece(f,2*this.radiusDisk,2*this.radiusDisk);g.body=f,f.SetUserData(g),f.CreateFixture(d),this.gamePieces.push(g),this.gamePieceLayer.addChild(g);var h=a.Util.NextRandom(5,15)*this.IndicatorGamePiece.dir;g.body.SetAngularVelocity(h)}else console.log("this.onGameStart() - game already in play. ABORTING")},resetPegs:function(){for(var a in this.pegs)this.pegs[a].reset()},resetGame:function(){this.totalScore=0,this.ballsLeft=this.gameChances,this.IndicatorGamePiece.show()},updateAllImages:function(){this.updateBackgroundImage(),this.updateProductImages()},updateProductImages:function(){this.productsLayer&&this.productsLayer.clear();for(var a=this.getImageAsset("productsImageSrc"),b=0;b =0;a--){var b=this.gamePieces[a];!b.body.IsAwake()&&b.scored&&(this.world.DestroyBody(b.body),this.gamePieces.splice(a,1),b.layer.removeChild(b))}for(var c in this.gamePieceLayer.children)this.gamePieceLayer.children[c].update();for(var d in this.productsLayer.children)this.productsLayer.children[d].update();for(var e in this.indicatorLayer.children)this.indicatorLayer.children[e].update();this.world.Step(1/60,1,1),this.drawDebugData&&this.world.DrawDebugData(),this.world.ClearForces(),document.StratiscapeDraw.draw(),document.stats&&document.stats.update()},initUtils:function(){var a=this;a.BGImage=Stratiscape.DrawnObject.extend({init:function(a,b,c){this.x=a,this.y=b,this.bgWidth=480,this.bgHeight=640,this.productWidth=420,this.productHeight=420,this.productPositionXoffset=60,this.src=c;var d=this;this.bgImageLoaded=!1,this.bgImage=new Image,this.bgImage.onload=function(){d.bgImageLoaded=!0},this.bgImage.src="/static/core/images/p3-2021/gameboard-bg.jpg",this.productImageLoaded=!1,this.productImage=new Image,this.productImage.onload=function(){d.productImageLoaded=!0},this.productImage.src=c},draw:function(a){if(this.bgImageLoaded&&this.productImageLoaded){a.drawImage(this.bgImage,this.x,this.y,this.bgWidth,this.bgHeight);var b=(this.bgWidth-this.productWidth)/2,c=(this.bgHeight-this.productHeight)/2-this.productPositionXoffset;a.drawImage(this.productImage,b,c,this.productWidth,this.productHeight)}else{var d=this;setTimeout(function(){d.draw(a)},20)}}}),a.WinnerText=Stratiscape.DrawnObject.extend({init:function(b,c,d){this.x=b,this.y=c,this.width=800,this.height=200,this.src=d;var e=Math.min(a.width/this.width,a.height/this.height);this.width*=e,this.height*=e,this.defaultWidth=this.width,this.defaultHeight=this.height,this.defaultPositionX=this.x-this.width/2,this.defaultPositionY=this.y-this.height/2;var f=this;this.imageLoaded=!1,this.image=new Image,this.image.onload=function(){f.imageLoaded=!0},this.image.src=this.src,this.hide()},draw:function(a){if(this.imageLoaded){var b=this.x-this.width/2,c=this.y-this.height;a.drawImage(this.image,b,c,this.width,this.height)}else{var d=this;setTimeout(function(){d.draw(a)},20)}},update:function(){},show:function(){this.x=this.defaultPositionX,this.y=this.defaultPositionY},hide:function(){this.y=-this.height},tween:function(){this.show(),this.x=a.width/2,this.y=a.height/2-this.height/2,this.width=0,this.height=0,TweenMax.to(this,1.2,{width:this.defaultWidth,height:this.defaultHeight,ease:Elastic.easeOut}),TweenMax.to(this,.4,{width:0,height:0,delay:1.2,y:a.height,ease:Cubic.easeIn,onComplete:this.tweenComplete,onCompleteParams:[this]})},tweenComplete:function(a){a.hide()}}),a.GamePiece=Stratiscape.DrawnObject.extend({init:function(b,c,d){this.body=b,this.width=c*a.scale,this.height=d*a.scale,this.wRadius=this.width/2,this.hRadius=this.height/2,this.imageLoaded=!1;var e=this;this.image=new Image,this.image.onload=function(){e.imageLoaded=!0},this.image.src="/static/core/images/p3-2021/ball.png"},update:function(){this.rotation=this.body.GetAngle(),this.x=this.body.GetWorldCenter().x*a.scale,this.y=this.body.GetWorldCenter().y*a.scale,this.layer.needsDisplay=!0},draw:function(a){if(a.save(),a.beginPath(),a.arc(this.x,this.y,this.wRadius,0*Math.PI,2*Math.PI),a.fillStyle="#f6c553",a.fill(),this.imageLoaded)a.translate(this.x,this.y),a.rotate(this.rotation),a.translate(-this.width/2,-this.height/2),a.drawImage(this.image,0,0);else{var b=this;setTimeout(function(){b.draw(a)},20)}a.restore()},onHit:function(){var b=new Box2D.Common.Math.b2Vec2(a.Util.NextRandom(10,20),a.Util.NextRandom(10,20)),c=a.Util.NextRandom(0,20)/a.scale;b=new Box2D.Common.Math.b2Vec2(c,0),this.body.ApplyImpulse(b,this.body.GetWorldCenter())}}),a.IndicatorGamePiece=Stratiscape.DrawnObject.extend({init:function(b,c,d){this.name="IndicatorGamePiece",this.body=b,this.posVec2=new Box2D.Common.Math.b2Vec2,this.dir=1,this.dirSpeed=.1,this.isHidden=!1,this.width=c*a.scale,this.height=d*a.scale,this.wRadius=this.width/2,this.hRadius=this.height/2,this.imageLoaded=!1;var e=this;this.image=new Image,this.image.onload=function(){e.imageLoaded=!0},this.image.src="/static/core/images/p3-2021/ball.png",this.x=this.body.GetWorldCenter().x*a.scale,this.y=this.body.GetWorldCenter().y*a.scale,this.show(),this.body.SetAwake(!1)},show:function(){var b=this.width/a.scale;this.posVec2.x=b/2,this.posVec2.y=.9,this.body.SetPosition(this.posVec2),this.dir=1,this.isHidden=!1},hide:function(){var b=this.width/a.scale;this.posVec2.x=b/2,this.posVec2.y=-.9,this.body.SetPosition(this.posVec2),this.isHidden=!0},update:function(){if(!this.isHidden){this.posVec2.x+=this.dirSpeed*this.dir,this.body.SetPosition(this.posVec2);var b=this.width/a.scale,c=a.width/a.scale;(this.body.GetPosition().x>=c-b/2||this.body.GetPosition().x<=b/2)&&(this.dir*=-1)}this.x=this.body.GetWorldCenter().x*a.scale,this.y=this.body.GetWorldCenter().y*a.scale,this.layer.needsDisplay=!0},draw:function(a){if(this.imageLoaded)a.save(),a.translate(this.x,this.y),a.rotate(this.rotation),a.translate(-this.width/2,-this.height/2),a.drawImage(this.image,0,0),a.restore();else{var b=this;setTimeout(function(){b.draw(a)},20)}}}),a.PrizeGamePiece=Stratiscape.DrawnObject.extend({init:function(b,c,d,e,f,g){this.x=b*a.scale,this.y=c*a.scale,this.width=e/a.scale,this.height=f/a.scale,this.productWidth=.9*this.width,this.productHeight=.9*this.width,this.productPositionXoffset=10,this.isTarget=g,this.hit=!1;var h=this,i=new a.Util.ColorRGBA(0,0,0,0);this.rect=new a.Rect(b,c,this.width,this.height,i,i),this.bgImageLoaded=!1,this.bgImage=new Image,this.bgImage.onload=function(){h.bgImageLoaded=!0},this.bgImage.src=!0===this.isTarget?"/static/core/images/p3-2021/prizepiece-target-bg.png":"/static/core/images/p3-2021/prizepiece-bg.png",this.productImageLoaded=!1,this.productImage=new Image,this.productImage.onload=function(){h.productImageLoaded=!0},this.productImage.src=d},draw:function(b){if(this.rect.draw(b),this.bgImageLoaded&&this.productImageLoaded)b.drawImage(this.bgImage,this.x,this.y,this.width*a.scale,this.height*a.scale),b.drawImage(this.productImage,this.x,this.y+this.productPositionXoffset,this.width*a.scale,this.width*a.scale);else{var c=this;setTimeout(function(){c.draw(b)},20)}},update:function(){this.layer.needsDisplay=!0},onHit:function(){var a=this;if(!this.hit){this.hit=!0;var b=this.y;TweenMax.to(a,.1,{y:b-25,yoyo:!0,repeat:3,onComplete:a.tweenComplete,onCompleteParams:[a]})}this.layer.needsDisplay=!0},tweenComplete:function(a){a.hit=!1}}),a.Peg=Stratiscape.DrawnObject.extend({init:function(b,c,d,e){this.x=b*a.scale,this.y=c*a.scale,this.width=d*a.scale,this.height=e*a.scale,this.initialWidth=this.width,this.initialHeight=this.height,this.highlighted=!1,this.type="Peg",this.hit=!1,this.color=a.defaultFillColor},update:function(){this.layer.needsDisplay=!0,this.x=this.body.GetWorldCenter().x*a.scale,this.y=this.body.GetWorldCenter().y*a.scale},onHit:function(){},tweenComplete:function(a){a.hit=!1},highlight:function(a,b){this.highlighted=a,this.color=b,this.layer.needsDisplay=!0},reset:function(){this.highlighted=!1,this.color=a.defaultFillColor,this.layer.needsDisplay=!0},draw:function(a){a.fillStyle=this.color.toString(),a.lineWidth=2,a.beginPath(),a.arc(this.x,this.y,this.width/2,0,2*Math.PI,!0),a.closePath(),a.fill(),a.stroke()}}),a.Rect=Stratiscape.DrawnObject.extend({init:function(b,c,d,e,f,g){this.x=b*a.scale,this.y=c*a.scale,this.width=d*a.scale,this.height=e*a.scale,this.fillColor=f,this.strokeColor=g},draw:function(a){a.fillStyle=this.fillColor.toString(),a.strokeStyle=this.strokeColor.toString(),a.fillRect(this.x,this.y,this.width,this.height),a.strokeRect(this.x,this.y,this.width,this.height)}}),a.Polygon=Stratiscape.DrawnObject.extend({init:function(b,c,d){this.points=[];for(var e=0;e b.r?this.r-1:this.r+1,this.g>b.g?this.g-1:this.g+1,this.b>b.b?this.b-1:this.b+1,this.a>b.a?this.a-1:this.a+1)},a.Util.ColorRGBA.prototype.equals=function(a){return this.r===a.r&&this.g===a.g&&this.b===a.b&&this.a===a.a},a.Util.ColorRGBA.prototype.toString=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.a+")"},a.Util.NextRandom=function(a,b){return null!==b&&void 0!==b||(b=a,a=0),a<0?b+=Math.abs(a):b-=a,Math.floor(Math.random()*b)+a},a.Util.parseShadow=function(a,b){a=a.split(", ");for(var c=[],d=0,e=a.length;d 0?c.Images[0].Url:"",alt:c.Images&&c.Images.length>0&&c.Images[0].ImageAltText?c.Images[0].ImageAltText:c.Title},inventory:{stockCountLabel:f.InventoryCountLabel,checkStockCountLabel:f.CheckAvailabilityLabel,checkOtherStockCountlabel:f.CheckOtherStoresLabel,ourStockLabel:f.OurStockLabel},link:b,pwr:{id:"pwr-snippet-"+c.Id,apiKey:f.TrendingSocialApiKey,merchantId:f.TrendingSocialMerchantId,merchantGroupId:f.TrendingSocialMerchantGroupId,locale:f.TrendingSocialLocale},text1:c.OfferShortText,text2:c.Title,text3:"",title:c.Title}},this);return{badge:{heading:b.Title,headline:b.HeadlineText,text:"",cta:{url:"products?categories="+b.CategoryKey,label:f.ExploreLabel,isUrlAbsolute:!1}},slides:c,isBadgeOnLeft:!this.isDesktopLarge||a}}},this)},tileBadges:function(){return this.homeBadges.map(function(a){return{image:{alt:this.isDesktop||this.isDesktopLarge?a.DesktopImageAltText:a.MobileImageAltText,url:this.isDesktop||this.isDesktopLarge?a.DesktopImage:a.MobileImage},link:{label:a.Title,target:a.CTALinkTarget,url:a.CTALink}}},this)}},data:function(){return{banners:f.BannerSlides,bannerCarouselSlidesToShow:{desktop:1,tablet:1,mobile:1},categories:f.Categories,categoryCarouselsSlidesToShow:{desktop:3,tablet:2,mobile:2},homeBadges:f.HomeBadges,isCategoriesActive:!1,products:f.Products}},methods:{hideCategories:function(){this.isCategoriesActive=!1},initPowerReviews:function(){for(var a=[],b=0;this.badgeCarousels.length>b;b++)for(var c=0;this.badgeCarousels[b].slides.length>c;c++){var d={api_key:this.badgeCarousels[b].slides[c].pwr.apiKey,locale:this.badgeCarousels[b].slides[c].pwr.locale,merchant_group_id:this.badgeCarousels[b].slides[c].pwr.merchantGroupId,merchant_id:this.badgeCarousels[b].slides[c].pwr.merchantId,page_id:this.badgeCarousels[b].slides[c].id,components:{CategorySnippet:this.badgeCarousels[b].slides[c].pwr.id}};a.push(d)}pwr("render",a)}},mixins:[d.Responsive],mounted:function(){this.showInventory="False"===f.HideInventory;var a=this;setTimeout(function(){a.initPowerReviews()},2e3)},name:"RouteHome",template:"#module-p3-2021-route-home"}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Mixins"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Vue.Modules.P32021.VueComponents"),f=b.resolve("SDM.Data.P32021"),g=a.$,h=b.resolve("SDM.Util");e.RoutePlay={name:"RoutePlay",template:"#module-p3-2021-route-play",components:{carousel:d.ProductCarousel,navigation:e.Navigation,game:e.Game,"pop-up":d.PopUp},props:{},mixins:[c.PCOLogin],data:function(){return{STATE_PRODUCTS:"stateProducts",STATE_PRODUCT_DETAILS:"stateProductDetail",STATE_FAVOURITES:"stateFavourites",STATE_FAVOURITES_DETAILS:"stateFavouritesDetail",STATE_SUBMIT:"submit",STATE_SUBMIT_DETAILS:"submitDetail",STATE_COMPLETE:"stateProductComplete",activeStep:0,communicationOptIn:!1,currentProductDetail:{},currentState:"",ballotOverlayShow:!1,ballotOverlayAnimIn:!1,hammertime:"",isEmailErrorValdidationVisible:!1,isEmailErrorServerVisible:!1,isEmailSuccessVisible:!1,isEmailSuccessNoOptInVisible:!1,isEmailSuccessOptinSucessVisible:!1,isEmailSuccessOptinFailVisible:!1,isEmailOptinFailVisible:!1,isSubmissionLoadingEmail:!1,isSubmitBallotLoading:!1,products:f.Products,selectedProducts:[],selectedProductsIds:[],submissionEmail:"",totalSteps:0,weekCount:0,currentWeekNumber:0,emailSubmissionErrors:{email:!1},productLeftSelected:!1,productRightSelected:!1,instructionalOverlayShow:!1,currentLang:h.getShortLanguageCode()}},created:function(){var a=f.WeeklyPrizeSchedule.filter(function(a){return!0===a.CurrentWeek});this.currentWeekNumber=a[0].WeekNumber,this.currentState=this.STATE_PRODUCTS},mounted:function(){if(this.totalSteps=this.weeklyProductPairs.length,"/contest/play/1"!==this.$route.path&&"/contest/play/submit"!==this.$route.path&&this.$router.push({path:"/contest/play/1"}),this.activeStep=1,"/contest/play/submit"===this.$route.path&&h.getValueFromCookie("p32022products")){this.selectedProductsIds=JSON.parse(h.getValueFromCookie("p32022products"));for(var a=0;a 0&&c.Images[0].ImageAltText?c.Images[0].ImageAltText:c.Title,src:c.Images&&c.Images.length>0?c.Images[0].Url:"",url:c.Images&&c.Images.length>0?c.Images[0].Url:""},link:{url:"/products/detail/"+c.Id,target:"_self",isAbsolute:!1},tag:"",title:c.Title,offer:c.OfferShortText}}},this)}}),data:function(){return{isAboutAccordionExpanded:!0,isLegalAccordionExpanded:!0,products:f.Products}},methods:Object.assign({},Vuex.mapActions("storeSelector",["setProductImageUrl","setProductHeading","setProductSubheading","setProductUpc"]),{checkAvailability:function(a){this.setProductImageUrl(a.Images&&a.Images.length>0?a.Images[0].Url:""),this.setProductHeading(a.Title),this.setProductUpc(a.Id),this.popUp.showPopUp()},goBack:function(){this.$router.go(-1)}}),mixins:[d.LockFocus],mounted:function(){setTimeout(function(){this.focusOnFirstElement()}.bind(this),500)},name:"RouteProductsDetail",template:"#module-p3-2021-route-products-detail",watch:{$route:function(){this.isAboutAccordionExpanded=!0,this.isLegalAccordionExpanded=!0}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Mixins"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Vue.Modules.P32021.VueComponents"),f=SDM.Data.P32021,g=b.resolve("SDM.Util"),h=a.$,i=a._;e.RouteProducts={components:{navigation:e.Navigation,"product-tile":d.ProductTile,"store-selector":d.StoreSelector},computed:{badgeTiles:function(){return this.productBadges.map(function(a){return{type:"badge",badgeTile:{image:{alt:this.isDesktop||this.isDesktopLarge?a.DesktopImageAltText:a.MobileImageAltText,url:this.isDesktop||this.isDesktopLarge?a.DesktopImage:a.MobileImage},link:{label:a.Title,target:a.CTALinkTarget,url:a.CTALink}}}},this)},filterdProducts:function(){return i.shuffle(this.productsByGroup.filter(function(a){var b=0===this.selectedBrands.length||this.selectedBrands.includes(a.BrandSlug),c=0===this.selectedCategories.length||a.Categories.reduce(function(a,b){return a||this.selectedCategories.includes(b.TitleSlug)}.bind(this),!1);return b&&c}.bind(this)))},filterdProductsByBrands:function(){return this.productsByGroup.filter(function(a){return 0===this.selectedBrands.length||this.selectedBrands.includes(a.BrandSlug)}.bind(this))},filterdProductsByCategories:function(){return this.productsByGroup.filter(function(a){return 0===this.selectedCategories.length||a.Categories.reduce(function(a,b){return a||this.selectedCategories.includes(b.TitleSlug)}.bind(this),!1)}.bind(this))},paginatedProducts:function(){var a=[];a.push(this.productTiles.slice(0,this.productPerPage-this.productBadgeSize*Math.min(this.badgeTiles.length,2)));for(var b=this.productTiles.slice(this.productPerPage-this.productBadgeSize*Math.min(this.badgeTiles.length,2),this.productTiles.length),c=0;c 0&&a.Images[0].ImageAltText?a.Images[0].ImageAltText:a.Title,src:a.Images&&a.Images.length>0?a.Images[0].Url:"",url:a.Images&&a.Images.length>0?a.Images[0].Url:""},link:{url:"/products/detail/"+a.Id,target:"_self",isAbsolute:!1},pwr:{id:"pwr-snippet-"+a.Id},tag:"",title:a.Title,offer:a.OfferShortText}}}},this)},productsByGroup:function(){return Object.keys(this.products).reduce(function(a,b){return this.products[b]&&this.products[b].ProductGroup===this.productGroup&&a.push(this.products[b]),a}.bind(this),[])},inventory:function(){return{stockCountLabel:f.InventoryCountLabel,checkStockCountLabel:f.CheckAvailabilityLabel,checkOtherStockCountlabel:f.CheckOtherStoresLabel}},isClearButtonEnabled:function(){return this.selectedBrands.length>0||this.selectedCategories.length>0},totalPageNumber:function(){var a=2,b=this.productTiles.length,c=a+b;return Math.ceil(c/this.productPerPage)}},data:function(){return{brands:f.BrandFilters,categories:f.CategoryFilters,componentKey:0,currentPageNumber:1,isFiltersActive:!1,filteredProductsBrands:[],filteredProductsCategories:[],products:f.Products,productBadges:f.ProductBadges,productBadgeSize:2,productPerPage:12,productGrid:[],selectedCategories:[],selectedBrands:[]}},methods:{clearFilter:function(){this.isClearButtonEnabled&&(this.selectedBrands=[],this.selectedCategories=[],this.filteredProductsCategories=this.getCategoriesFromProducts(this.productsByGroup),this.filteredProductsBrands=this.getBrandsFromProducts(this.productsByGroup),this.currentPageNumber=1,this.updateUrlParam(),this.initProductGrid())},getBrandsFromProducts:function(a){return a.reduce(function(a,b){return-1===a.findIndex(function(a){return a===b.BrandSlug})&&a.push(b.BrandSlug),a},[]).map(function(a){return this.brands.find(function(b){if(b.TitleSlug===a)return b})}.bind(this)).sort(function(a,b){return a.Title b.Title?1:0})},getCategoriesFromProducts:function(a){return a.reduce(function(a,b){return b.Categories.forEach(function(b){-1===a.findIndex(function(a){return a===b.TitleSlug})&&a.push(b.TitleSlug)}),a},[]).map(function(a){return this.categories.find(function(b){if(b.TitleSlug===a)return b})}.bind(this)).sort(function(a,b){return a.Title b.Title?1:0})},hideFilters:function(){this.isFiltersActive=!1},initialize:function(){this.selectedCategories=[],this.selectedBrands=[]},initPowerReviews:function(){for(var a=[],b=this.paginatedProducts[this.currentPageNumber-1],c=0;b.length>c;c++)a[c]={api_key:f.TrendingSocialApiKey,locale:f.TrendingSocialLocale,merchant_group_id:f.TrendingSocialMerchantGroupId,merchant_id:f.TrendingSocialMerchantId,page_id:b[c].productTile.product.id,components:{CategorySnippet:b[c].productTile.product.pwr.id}};pwr("render",a)},initProductGrid:function(){var a=this.currentPageNumber*this.productPerPage-this.productBadgeSize*Math.min(this.badgeTiles.length,2),b=this.productTiles.slice(0,a);this.badgeTiles.length>0&&b.splice(2,0,this.badgeTiles[0]),this.badgeTiles.length>1&&b.splice(7,0,this.badgeTiles[1]);var c=this;this.productGrid=b,setTimeout(function(){c.initPowerReviews()},100)},loadMoreProducts:function(){g.scrollTo$ElementAsync(h(this.$refs.loadMoreButton),500),this.currentPageNumber=this.currentPageNumber+1,this.initProductGrid()},onBrandsFilterChange:function(){this.currentPageNumber=1,this.filteredProductsCategories=this.getCategoriesFromProducts(this.filterdProductsByBrands);var a=this.selectedCategories.filter(function(a){return this.filteredProductsCategories.findIndex(function(b){return b.TitleSlug===a})>=0}.bind(this));this.selectedCategories.length!==a.length&&(this.selectedCategories=a),this.updateUrlParam(),this.initProductGrid()},onCategoriesFilterChange:function(){this.currentPageNumber=1,this.filteredProductsBrands=this.getBrandsFromProducts(this.filterdProductsByCategories);var a=this.selectedBrands.filter(function(a){return this.filteredProductsBrands.findIndex(function(b){return b.TitleSlug===a})>=0}.bind(this));this.selectedBrands.length!==a.length&&(this.selectedBrands=a),this.updateUrlParam(),this.initProductGrid()},updateUrlParam:function(){var a={};this.selectedBrands.length>0&&(a=Object.assign({},a,{brands:this.selectedBrands.join(",")})),this.selectedCategories.length>0&&(a=Object.assign({},a,{categories:this.selectedCategories.join(",")})),g.setUrlVars(a)}},mixins:[c.Responsive],mounted:function(){this.routeBrands&&this.routeBrands.split(",").forEach(function(a){this.selectedBrands.push(a)},this),this.routeCategories&&this.routeCategories.split(",").forEach(function(a){this.selectedCategories.push(a)},this),this.filteredProductsCategories=this.getCategoriesFromProducts(this.productsByGroup),this.filteredProductsBrands=this.getBrandsFromProducts(this.filterdProductsByCategories),this.initProductGrid()},name:"RouteProducts",props:{routeBrands:{type:String,default:""},routeCategories:{type:String,default:""}},template:"#module-p3-2021-route-products",watch:{filterdProducts:function(){this.currentPageNumber=1},productsByGroup:function(){this.filteredProductsBrands=this.getBrandsFromProducts(this.productsByGroup),this.filteredProductsCategories=this.getCategoriesFromProducts(this.productsByGroup)},productGroup:function(){this.initialize()}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.P32021.VueComponents"),d=SDM.Data.P32021;c.RouteTrending={components:{navigation:c.Navigation},data:function(){return{isModalActive:!1,videoData:[],focusableElements:'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], [contenteditable]'}},methods:{initSocial:function(){POWERREVIEWS.display.render({api_key:d.TrendingSocialApiKey,locale:d.TrendingSocialLocale,merchant_id:d.TrendingSocialMerchantId,CD4_IRL_IMAGE_GALLERY_STYLE:"GRID",components:{IRLSnippet:"module-top-picks-2020-trending__social"}})},initVideo:function(a){if(a){var b=this.findObjectByKey(this.videoData,"FriendlyUrlTitle",a);this.onVideoThumbnailClick(b.YouTubeVideoID,b.Title)}else this.onCloseVideo()},onVideoThumbnailClick:function(a,b){this.isModalActive=!0,document.body.style.overflow="hidden",document.querySelector("#module-p3-2021-route-trending-video-embed__video").innerHTML='',TweenMax.to(".module-p3-2021-route-trending-video-embed",.4,{opacity:1}),setTimeout(function(){$(".module-p3-2021-route-trending-video-embed__close").focus()},500)},onCloseVideo:function(){if(this.isModalActive){var a=this;TweenMax.to(".module-p3-2021-route-trending-video-embed",.3,{opacity:0,onComplete:a.closeVideo})}},closeVideo:function(){this.isModalActive=!1,document.body.style.overflow="auto",document.querySelector("#module-p3-2021-route-trending-video-embed__video").innerHTML=""},findObjectByKey:function(a,b,c){for(var d=0;d 0))return null;var c=b.Games[0];return{cta:{isAbsolute:!1,label:e.PlayButtonLabel,url:"/play?week="+(a+1)+"&game=1"},heading:e.GameLabel+" 1",productImages:c.Products.map(function(a){var b=this.products[a];return b?{url:b.Images&&b.Images.length>0&&b.Images[0].Url?b.Images[0].Url:"",alt:b.Images&&b.Images.length>0&&b.Images[0].ImageAltText?b.Images[0].ImageAltText:b.Title}:null},this)}}},data:function(){return{products:e.Products,weeks:e.WeeklyPrizeSchedule}},methods:{goBack:function(){this.$router.go(-1)}},mixins:[c.Responsive],mounted:function(){},name:"RouteTutorial",template:"#module-p3-2021-route-tutorial"}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Modules.P32021.VueComponents"),f=b.resolve("SDM.Data.P32021");c.P32021=function(){var a=[{component:e.RouteHome,name:"home",path:"/"},{component:e.RouteContest,name:"contest",path:"/contest"},{component:e.RouteTutorial,name:"how-to-play",path:"/contest/how-to-play"},{component:e.RoutePlay,name:"play",path:"/contest/play",redirect:"/contest/play/1"},{component:e.RoutePlay,name:"play",path:"/contest/play/:step"},{component:e.RoutePlay,name:"play",path:"/contest/play/:step/:product"},{component:e.RouteProducts,name:"products",path:"/products",props:function(a){return{routeBrands:a.query.brands,routeCategories:a.query.categories}}},{component:e.RouteProductsDetail,name:"detail",path:"/products/detail/:productId"}];"True"!==f.HideTrending?(a.push({component:e.RouteTrending,name:"trending",path:"/trending"}),a.push({component:e.RouteTrending,name:"trending",path:"/trending/:videoId"})):(a.push({component:e.RouteTrending,name:"trending",path:"/trending",redirect:"/"}),a.push({component:e.RouteTrending,name:"trending",path:"/trending/:videoId",redirect:"/"}));var b=new VueRouter({base:f.CampaignRoute,mode:"history",routes:a,scrollBehavior:function(){if(this&&this.app&&this.app.$el){var a='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], [contenteditable]',b=this.app.$el.querySelectorAll(a)[0];b&&b.focus()}return{x:0,y:0,behavior:"smooth"}}}),c=new Vuex.Store({modules:{storeSelector:d.StoreSelector,p32021:{actions:{setGameScore:function(a,b){a.commit("setGameScore",b)},setIsGameCompleted:function(a,b){a.commit("setIsGameCompleted",b)}},mutations:{setGameScore:function(a,b){a.gameScore=b},setIsGameCompleted:function(a,b){a.isGameCompleted=b}},namespaced:!0,state:function(){return{gameScore:0,isGameCompleted:!1}}}}});new Vue({components:{"footer-menu":e.FooterMenu},el:"#module-p3-2021",methods:Object.assign({},Vuex.mapActions("storeSelector",{setInventories:"setInventories"}),{}),mounted:function(){this.setInventories(f.Inventories.Stores)},router:b,store:c})}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.Spring2021.VueComponents").Footer={computed:{},data:function(){return{}},methods:{},mounted:function(){},props:{},template:"#module-spring-2021-footer",updated:function(){},watch:{}}}(this,this.jQuery),function(a){var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Subscription"),e=b.resolve("SDM.Util"),f=b.resolve("SDM.Data.PromoSignUp");c.PromoSignUp=function(){new Vue({el:"#module-promo-sign-up",data:function(){return{submissionEmail:"",submissionTelephone:"",isSubmissionLoadingEmail:!1,isSubmissionLoadingTelephone:!1,email:"",errors:{email:!1},isSending:!1,isSent:!1,isPhoneErrorValdidationVisible:!1,isPhoneErrorServerVisible:!1,isPhoneSuccessVisible:!1,isSubmissionLoadingPhone:!1,isEmailErrorValdidationVisible:!1,isEmailErrorServerVisible:!1,isEmailSuccessVisible:!1,isDropDownVisible:!1}},created:function(){},mounted:function(){},components:{},methods:{checkSubmissionTelephone:function(){return!!this.isSubmissionTelephoneValid},submitEmail:function(){this.isEmailErrorValdidationVisible=!1,this.isEmailErrorServerVisible=!1;var a=this.$refs.signupForm.dataset.wgEsCasl||"";this.$refs.email&&(this.errors.email=!(this.submissionEmail.length&&/\S+@\S+/.test(this.submissionEmail))),_.some(this.errors,function(a){return a})?(this.isEmailErrorValdidationVisible=!0,this.reportValidation(this.$refs.email,f.EmailErrorValidation)):(this.isSubmissionLoadingEmail=!0,this.isEmailErrorValdidationVisible=!1,this.isEmailErrorServerVisible=!1,this.isSending=!0,d.signup(this.submissionEmail,a).done(_.bind(function(){console.log("1"),this.isSent=!0,this.isEmailSuccessVisible=!0,e.saveCookie("salesforceSubscription","true")},this)).fail(_.bind(function(a){console.log("2"),this.isEmailErrorServerVisible=!0,console.log(a)},this)).always(_.bind(function(){console.log("3"),this.isSending=!1,this.isSubmissionLoadingEmail=!1},this)))},submitPhone:function(a,b,c){if(this.checkSubmissionTelephone()){var d=this.submissionTelephone.replace(/[()-.]/g,"");this.isSubmissionLoadingPhone=!0,this.isPhoneErrorValdidationVisible=!1,this.isPhoneErrorServerVisible=!1;var e=JSON.stringify({PhoneNumber:d,ShortCode:c,TriggerID:b});$.ajax({method:"POST",contentType:"application/json",url:"/global/submitphoneto3c",data:e,dataType:"json",headers:{__RequestVerificationToken:a}}).done(function(a){"OK"===a.status?(this.isPhoneSuccessVisible=!0,this.isPhoneErrorValdidationVisible=!1):(this.isPhoneErrorServerVisible=!0,console.log("ERROR: "),console.log(a.message))}.bind(this)).fail(function(a){this.isPhoneErrorServerVisible=!0,console.log("ERROR: "),console.log(a)}.bind(this)).always(function(){this.isSubmissionLoadingPhone=!1}.bind(this))}else this.isPhoneErrorServerVisible=!1,this.isPhoneErrorValdidationVisible=!0,this.reportValidation(this.$refs.tel,f.PhoneErrorValidation)},reportValidation:function(a,b){a.validity&&a.setCustomValidity(b),a.reportValidity()},toggleDropdown:function(){this.isDropDownVisible=!this.isDropDownVisible}},computed:{isSubmissionTelephoneValid:function(){return""!==this.submissionTelephone&&null!==this.submissionTelephone.match(/^[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}$/im)}},watch:{email:function(){this.submissionEmail.length&&(this.errors.email=!1)}}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Data.Spring2021"),d=b.resolve("SDM.Vue.Modules.Spring2021.VueComponents"),e=b.resolve("SDM.Vue.Widgets"),f=b.resolve("SDM.Vue.Mixins");d.Hero={template:"#spring-2021-hero-template",components:{carousel:e.ProductCarousel},mixins:[f.Responsive],props:{baseBackgroundColor:String,featuredBadges:Object,themesModel:Array,ttwBackgroundColor:String},data:function(){return{banner:{},banners:c.BannerSlides,bannerCarouselSlidesToShow:{desktop:1,tablet:1,mobile:1},currentCategory:"",currentSection:"",headerHexColor:"",heroImage:"",heroImageMobile:"",toPath:"",fromPath:"",themeModel:{},isTextToWin:!1,selectedTheme:{}}},created:function(){this.updateCurrentSection()},mounted:function(){this.updateHeroBanner()},methods:{updateCurrentSection:function(){this.$route.path.split("/").filter(String)[0]?this.currentSection=this.$route.path.split("/").filter(String)[0].toLowerCase():this.currentSection="/"},updateHeroBanner:function(){if("products"===this.currentSection)if(this.$route.params.productId)this.banner={};else if(1===this.$store.state.theme.length){var a=this;this.banner=c.ThemesJson.filter(function(b){return b.ThemeKey===a.$store.state.theme[0]})[0]}else this.banner={BannerDesktop:c.HeroProductsImageDesktop,BannerMobile:c.HeroProductsImageMobile,BannerDesktopAltText:c.HeroProductsAltText,FeaturedHeroBackgroundHex:c.HeroProductsBackgroundHexColor};else"contest"===this.currentSection?this.banner={BannerDesktop:c.HeroTTWImageDesktop,BannerMobile:c.HeroTTWImageMobile,BannerDesktopAltText:c.HeroTTWAltText,FeaturedHeroBackgroundHex:c.HeroTTWBackgroundHexColor}:"meditations-and-more"===this.currentSection&&(this.banner={BannerDesktop:c.HeroMeditationsImageDesktop,BannerMobile:c.HeroMeditationsImageMobile,BannerDesktopAltText:c.HeroMeditationsAltText,CarouselBackgroundHex:c.HeroMeditationsBackgroundHexColor})}},computed:{bannerCarousel:function(){return this.banners.map(function(a){var b=document.createElement("div");b.innerHTML=a.UrlLink?a.UrlLink.trim():"";var c=b.firstChild;return{backgroundColor:a.BackgroundHexColor,image:{url:this.isDesktop||this.isDesktopLarge?a.ImageDesktop.URL:a.ImageMobile.URL,alt:this.isDesktop||this.isDesktopLarge?a.ImageDesktop.Label:a.ImageMobile.Label},link:{isAbsolute:!0,target:c?c.target:"",url:c?c.href:""}}},this)},bannerCarouselProps:function(){return{slides:this.bannerCarousel,slidesToShow:this.bannerCarouselSlidesToShow,isArrowsVisible:{desktop:!0,tablet:!1,mobile:!1},isAutoplay:{desktop:!0,tablet:!0,mobile:!0},isControlsInset:{desktop:!0,tablet:!0,mobile:!0},isPaginationVisible:{desktop:!0,tablet:!0,mobile:!0}}}},watch:{$route:function(a,b){this.toPath=a.path,this.fromPath=b.path,this.updateCurrentSection(),this.updateHeroBanner()},"$store.state.theme":function(){this.updateHeroBanner()}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Spring2021.VueComponents"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Data.Spring2021");c.Navigation={template:"#module-spring-2021-navigation",components:{navigation:d.Navigation},data:function(){return{menuLabel:e.MobileMenuLabel,menuOpenLabel:e.MobileMenuOpenLabel,menuCloseLabel:e.MobileMenuCloseLabel,links:[]}},mounted:function(){this.links.push({isAbsolute:!1,label:e.HomeTabLabel,target:"",url:"/"}),this.links.push({isAbsolute:!1,label:e.ProductsTabLabel,target:"",url:"/products"}),this.links.push({isAbsolute:!1,label:e.TrendingTabLabel,target:"",url:"/meditations-and-more"}),this.links.push({isAbsolute:!1,label:e.TextToWinTabLabel,target:"",url:"/contest"})},methods:{},computed:{}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Spring2021.VueComponents"),d=b.resolve("SDM.Vue.Mixins"),e=b.resolve("SDM.Vue.Widgets"),f=SDM.Data.Spring2021,g=b.resolve("SDM.Util"),h=a.$;c.ProductsGrid={template:"#module-spring-2021-products-grid",components:{"product-tile":e.ProductTile,"store-selector":e.StoreSelector},mixins:[d.Responsive],props:{routeFilters:{type:String,default:""},routeCategories:{type:String,default:""},themeHeading:{type:String,default:""},themeKey:{type:String,default:""}},data:function(){return{categories:f.Categories,currentPageNumber:0,isFiltersActive:!1,isFiltersMobile:!1,filteredProductsThemes:[],filteredProductsCategories:[],productsJsonData:{},productBadges:f.ProductBadges,productBadgeSize:2,productGrid:[],productPerPage:12,screenWidth:0,selectedThemes:[],selectedCategories:[],subThemeFilters:[],themeBadgesData:[],themesJsonData:f.Themes}},mounted:function(){this.productsJsonData=f.Products,this.selectedThemes=this.$route.query.themes?this.$route.query.themes.split(","):[],this.selectedCategories=this.$route.query.categories?this.$route.query.categories.split(","):[],this.$store.state.theme=this.selectedThemes,this.filteredProductsThemes=this.getThemesFromProducts(this.productsByGroup),this.filteredProductsCategories=this.getCategoriesFromProducts(this.productsByGroup),this.initProductGrid(),window.addEventListener("resize",_.debounce(this.onResize,50)),this.onResize()},methods:{clearFilter:function(){this.isClearButtonEnabled&&(this.selectedThemes=[],this.selectedCategories=[],this.filteredProductsCategories=this.getCategoriesFromProducts(this.productsByGroup),this.filteredProductsThemes=this.getThemesFromProducts(this.productsByGroup),this.currentPageNumber=0,this.productGrid=[],this.updateUrlParam(),this.initProductGrid())},onResize:function(){this.screenWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),this.screenWidth>640?(TweenLite.set(".module-spring-2021-products__filters-container",{height:"auto"}),this.isFiltersActive=!1,this.isFiltersMobile=!1):this.isFiltersMobile||(TweenLite.set(".module-spring-2021-products__filters-container",{height:0}),this.isFiltersActive=!1,this.isFiltersMobile=!0)},getThemesFromProducts:function(a){return a.reduce(function(a,b){return b.Themes.forEach(function(b){-1===a.findIndex(function(a){return a===b.TitleSlug})&&a.push(b.TitleSlug)}),a},[]).map(function(a){return this.themesJsonData.find(function(b){if(b.TitleSlug===a)return b})}.bind(this)).sort(function(a,b){return a.Title b.Title?1:0})},getCategoriesFromProducts:function(a){return a.reduce(function(a,b){return b.Categories.forEach(function(b){-1===a.findIndex(function(a){return a===b.TitleSlug})&&a.push(b.TitleSlug)}),a},[]).map(function(a){return this.categories.find(function(b){if(b.TitleSlug===a)return b})}.bind(this)).sort(function(a,b){return a.Title b.Title?1:0})},hideFilters:function(){this.isFiltersActive=!1},initPowerReviews:function(){for(var a=[],b=this.paginatedProducts[this.currentPageNumber],c=0;b.length>c;c++)"product"===b[c].type&&(a[c]={api_key:f.PowerReviewsApiKey,locale:f.PowerReviewsLocale,merchant_group_id:f.PowerReviewsMerchantGroupId,merchant_id:f.PowerReviewsMerchantId,page_id:b[c].productTile.product.id,components:{CategorySnippet:b[c].productTile.product.pwr.id}});pwr("render",a)},initProductGrid:function(){this.productGrid=this.productGrid.concat(this.paginatedProducts[this.currentPageNumber]);var a=this;Vue.nextTick(function(){a.initPowerReviews()})},loadMoreProducts:function(){g.scrollTo$ElementAsync(h(this.$refs.loadMoreButton),500),this.currentPageNumber++,this.initProductGrid()},onThemesFilterChange:function(){this.filteredProductsCategories=this.getCategoriesFromProducts(this.filterdProductsByThemes);var a=this.selectedCategories.filter(function(a){return this.filteredProductsCategories.findIndex(function(b){return b.TitleSlug===a})>=0}.bind(this));this.selectedCategories.length!==a.length&&(this.selectedCategories=a),this.currentPageNumber=0,this.productGrid=[],this.updateUrlParam(),this.initProductGrid()},onCategoriesFilterChange:function(){this.filteredProductsThemes=this.getThemesFromProducts(this.filterdProductsByCategories);var a=this.selectedThemes.filter(function(a){return this.filteredProductsThemes.findIndex(function(b){return b.TitleSlug===a})>=0}.bind(this));this.selectedThemes.length!==a.length&&(this.selectedThemes=a),this.currentPageNumber=0,this.productGrid=[],this.updateUrlParam(),this.initProductGrid()},updateUrlParam:function(){var a={};this.selectedThemes.length>0?(a=Object.assign({},a,{themes:this.selectedThemes.join(",")}),this.$store.state.theme=this.selectedThemes):this.$store.state.theme=[],this.selectedCategories.length>0&&(a=Object.assign({},a,{categories:this.selectedCategories.join(",")})),g.setUrlVars(a)}},computed:{badgeTiles:function(){return this.productBadges.map(function(a){return{type:"badge",badgeTile:{image:{alt:a.DesktopImageAltText,desktopUrl:a.DesktopImage,mobileUrl:a.MobileImage},link:{label:a.Title,target:a.CTALinkTarget,url:a.CTALink}}}},this)},filterdProducts:function(){return _.shuffle(this.productsByGroup.filter(function(a){var b=0===this.selectedThemes.length||a.Themes.reduce(function(a,b){return a||this.selectedThemes.includes(b.TitleSlug)}.bind(this),!1),c=0===this.selectedCategories.length||a.Categories.reduce(function(a,b){return a||this.selectedCategories.includes(b.TitleSlug)}.bind(this),!1);return b&&c}.bind(this)))},filterdProductsByThemes:function(){return this.productsByGroup.filter(function(a){return 0===this.selectedThemes.length||a.Themes.reduce(function(a,b){return a||this.selectedThemes.includes(b.TitleSlug)}.bind(this),!1)}.bind(this))},filterdProductsByCategories:function(){return this.productsByGroup.filter(function(a){return 0===this.selectedCategories.length||a.Categories.reduce(function(a,b){return a||this.selectedCategories.includes(b.TitleSlug)}.bind(this),!1)}.bind(this))},isClearButtonEnabled:function(){return this.selectedThemes.length>0||this.selectedCategories.length>0},paginatedProducts:function(){var a=[],b=this.productTiles.slice(0,this.productPerPage-this.productBadgeSize*Math.min(this.badgeTiles.length,2));b.length>=2&&this.badgeTiles.length>0&&b.splice(2,0,this.badgeTiles[0]),b.length>=7&&this.badgeTiles.length>1&&b.splice(7,0,this.badgeTiles[1]),a.push(b);for(var c=this.productTiles.slice(this.productPerPage-this.productBadgeSize*Math.min(this.badgeTiles.length,2),this.productTiles.length),d=0;d 0?a.Images[0].Url:""},link:b,pwr:{id:"pwr-snippet-"+a.Id},tags:a.Tags,title:a.Title,offer:a.OfferShortText}}}},this)},productsByGroup:function(){return Object.keys(this.productsJsonData).reduce(function(a,b){return this.productsJsonData[b]&&this.productsJsonData[b].ProductGroup===this.productGroup&&a.push(this.productsJsonData[b]),a}.bind(this),[])},inventory:function(){return{stockCountLabel:f.InventoryCountLabel,checkStockCountLabel:f.CheckAvailabilityLabel,checkOtherStockCountlabel:f.CheckOtherStoresLabel}},totalPageNumber:function(){var a=4,b=this.productTiles.length,c=a+b;return Math.ceil(c/this.productPerPage)-1}},watch:{filterdProducts:function(){this.currentPageNumber=0},productsByGroup:function(){}}}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.Spring2021.VueComponents").BadgeCta={computed:{},data:function(){return{}},methods:{},mounted:function(){},props:{badge:{type:Object,default:null}},template:"#module-spring-2021-badge-cta",updated:function(){},watch:{}}}(this,this.jQuery),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Spring2021.VueComponents"),d=b.resolve("SDM.Vue.Mixins");c.Video={template:"#module-spring-2021-video",components:{},props:{videoData:[]},data:function(){return{isModalActive:!1}},mixins:[d.LockFocus],mounted:function(){this.$route.query.v&&this.initVideo(this.$route.query.v)},methods:{initVideo:function(a){this.onVideoThumbnailClick(a)},onVideoThumbnailClick:function(a){this.isModalActive=!0,document.body.style.overflow="hidden",document.querySelector("#module-spring-2021-video-embed__video").innerHTML='',TweenMax.to(".module-spring-2021-video-embed",.4,{opacity:1}),setTimeout(function(){$(".module-spring-2021-video-embed__close").focus()},500)},onCloseVideo:function(){if(this.isModalActive){var a=this;TweenMax.to(".module-spring-2021-video-embed",.3,{opacity:0,onComplete:a.closeVideo})}},closeVideo:function(){this.isModalActive=!1,document.body.style.overflow="auto",document.querySelector("#module-spring-2021-video-embed__video").innerHTML=""},findObjectByKey:function(a,b,c){for(var d=0;d b;b++)for(var c=0;this.badgeCarousels[b].slides.length>c;c++){var d={api_key:g.PowerReviewsApiKey,locale:g.PowerReviewsLocale,merchant_group_id:g.PowerReviewsMerchantGroupId,merchant_id:g.PowerReviewsMerchantId,page_id:this.badgeCarousels[b].slides[c].id,components:{CategorySnippet:this.badgeCarousels[b].slides[c].pwr.id}};a.push(d)}pwr("render",a)},hideCategories:function(){this.isSeeAllListsActive=!1}},components:{badgeCta:c.BadgeCta,carousel:f.ProductCarousel,"store-selector":f.StoreSelector,"video-modal":c.Video},computed:{badgeCarousels:function(){var a=!0;return this.categories.map(function(b){a=!a;var c=b.FeaturedProducts.map(function(a){var c={};return c=""!==a.BuyNowLink?{url:a.BuyNowLink,urlTarget:"_blank",target:"_blank",isUrlAbsolute:!0,isAbsolute:!0}:{url:"/products/"+a.Id+"?themes="+b.ThemeKey,urlTarget:"_self",isUrlAbsolute:!1},{id:a.Id,image:{url:a.Images&&a.Images.length>0?a.Images[0].Url:"",alt:a.Title},inventory:{stockCountLabel:g.InventoryCountLabel,checkStockCountLabel:g.CheckAvailabilityLabel,checkOtherStockCountlabel:g.CheckOtherStoresLabel,ourStockLabel:g.OurStockLabel},link:c,pwr:{id:"pwr-snippet-"+a.Id},text1:a.OfferShortText,text2:a.Title,text3:"",tags:a.Tags}},this);return{badge:{heading:b.CarouselText,hexColorBg:b.CarouselBackgroundHex,hexColorFont:b.CarouselFontHex,hexColorCta:b.FeaturedCarouselButtonBgHex,hexColorCtaLabel:b.CarouselButtonFontHex,text:"",cta:{url:"/products?themes="+b.ThemeKey,label:g.ExploreLabel,isUrlAbsolute:!1}},slides:c,isBadgeOnLeft:!this.isDesktopLarge||a}},this)},bottomBadges:function(){return this.bottomBadgesData.map(function(a){return{image:{alt:this.isDesktop||this.isDesktopLarge?a.DesktopImageAltText:a.MobileImageAltText,url:this.isDesktop||this.isDesktopLarge?a.DesktopImage:a.MobileImage},link:{isAbsolute:!1,target:a.CTALinkTarget,url:a.CTALink},youTubeVideoId:a.YouTubeVideoID,youTubeVideoCta:a.TitleSlug}},this)},tileBadges:function(){return this.homeBadges.map(function(a){return{image:{alt:this.isDesktop||this.isDesktopLarge?a.DesktopImageAltText:a.MobileImageAltText,url:this.isDesktop||this.isDesktopLarge?a.DesktopImage:a.MobileImage},link:{label:a.Title,target:a.CTALinkTarget,url:a.CTALink}}},this)}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Spring2021.VueComponents");b.resolve("SDM.Vue.Modules.Spring2021.VueRoutes").Products={template:"#module-spring-2021-products",name:"RouteProducts",components:{"products-grid":c.ProductsGrid},data:function(){return{}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Widgets"),d=b.resolve("SDM.Vue.Modules.Spring2021.VueRoutes"),e=b.resolve("SDM.Data.Spring2021");d.ProductsDetail={data:function(){return{componentKey:0,currentImageIndex:0,isAboutAccordionExpanded:!0,isLegalAccordionExpanded:!1,product:{},relatedProducts:[],toRoute:"",fromRoute:""}},name:"RouteProductDetail",template:"#module-spring-2021-route-products-detail",components:{productTile:c.ProductTile,"store-selector-modal":c.StoreSelectorModal},mounted:function(){this.initProducts()},beforeRouteEnter:function(a,b,c){c(c(function(c){c.toRoute=a,c.fromRoute=b}))},methods:Object.assign({},Vuex.mapActions("storeSelector",["setProductImageUrl","setProductHeading","setProductSubheading","setProductUpc"]),{initProducts:function(){var a=this;this.product=e.Products.filter(function(b){return b.Id===a.$route.params.productId}),this.product=this.product[0],this.relatedProducts=[],this.product.RelatedProductIDs.length>0&&this.product.RelatedProductIDs.forEach(function(b){a.relatedProducts.push(e.Products.filter(function(a){return a.Id===b})[0])}),Vue.nextTick(function(){a.initPowerReviews(),TweenLite.to(".module-spring-2021-route-products-detail",.4,{opacity:1,delay:.2})})},checkAvailability:function(a){this.setProductImageUrl(a.Images&&a.Images.length>0?a.Images[0].Url:""),this.setProductHeading(a.Title),this.setProductUpc(a.Id),this.popUp.showPopUp()},goBack:function(){this.fromRoute.name?this.$router.go(-1):this.$router.push("/products")},initPowerReviews:function(){for(var a=[],b=0;this.relatedProductTiles.length>b;b++)a[b]={api_key:e.PowerReviewsApiKey,locale:e.PowerReviewsLocale,merchant_group_id:e.PowerReviewsMerchantGroupId,merchant_id:e.PowerReviewsMerchantId,page_id:this.relatedProductTiles[b].product.id,components:{CategorySnippet:this.relatedProductTiles[b].product.pwr.id}};pwr("render",a)},toggleAboutAccordian:function(){this.isAboutAccordionExpanded?(TweenLite.to(".module-spring-2021-route-products-detail__accordion-text-wrapper--about",.4,{height:0}),this.isAboutAccordionExpanded=!1):(TweenLite.set(".module-spring-2021-route-products-detail__accordion-text-wrapper--about",{height:"auto"}),TweenLite.from(".module-spring-2021-route-products-detail__accordion-text-wrapper--about",.4,{height:0}),this.isAboutAccordionExpanded=!0)},thumbnailClick:function(a){this.currentImageIndex=a},toggleAccordian:function(a,b){"about"===b?this.isAboutAccordionExpanded?(TweenLite.to(a,.4,{height:0}),this.isAboutAccordionExpanded=!1):(TweenLite.set(a,{height:"auto"}),TweenLite.from(a,.4,{height:0}),this.isAboutAccordionExpanded=!0):"legal"===b&&(this.isLegalAccordionExpanded?(TweenLite.to(a,.4,{height:0}),this.isLegalAccordionExpanded=!1):(TweenLite.set(a,{height:"auto"}),TweenLite.from(a,.4,{height:0}),this.isLegalAccordionExpanded=!0))}}),computed:Object.assign({},Vuex.mapState("storeSelector",["inventories","popUp","selectedStore"]),{relatedProductTiles:function(){return this.relatedProducts.map(function(a){var b;return b=""!==a.BuyNowLink?{url:a.BuyNowLink,urlLabel:e.BuyNowLabel,urlTarget:"_blank",target:"_blank",isUrlAbsolute:!0,isAbsolute:!0}:{url:"/products/"+a.Id+window.location.search,urlLabel:e.ProductCTALabel,urlTarget:"_self",isUrlAbsolute:!1,isAbsolute:!1},{componentKey:a.Id+Math.round(1e6*Math.random()),cta:b,inventory:{stockCountLabel:e.InventoryCountLabel,checkStockCountLabel:e.CheckAvailabilityLabel,checkOtherStockCountlabel:e.CheckOtherStoresLabel},product:{id:a.Id,image:{alt:a.Images&&a.Images.length>0&&a.Images[0].ImageAltText?a.Images[0].ImageAltText:a.Title,url:a.Images&&a.Images.length>0?a.Images[0].Url:""},link:b,pwr:{id:"pwr-snippet-"+a.Id},tags:a.Tags,title:a.Title,offer:a.OfferShortText}}},this)}}),watch:{$route:function(){this.initProducts()}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Spring2021.VueRoutes"),d=b.resolve("SDM.Vue.Widgets");c.Contest={template:"#module-spring-2021-route-contest",components:{"pop-up":d.PopUp},props:{},data:function(){return{isPopUpErrorVisible:!1,isPopUpSubmissionVisible:!0,isPopUpCompletionVisible:!1,isPrize1Collapsed:!0,isPrize2Collapsed:!0,isPrize3Collapsed:!0,isSubmissionLoading:!1,submissionTelephone:""}},created:function(){},mounted:function(){},methods:{initializeSubmissionPopUp:function(){this.submissionTelephone="",this.isPopUpSubmissionVisible=!0,this.isPopUpCompletionVisible=!1,this.isPopUpErrorVisible=!1},checkSubmissionTelephone:function(){return this.isSubmissionTelephoneValid?(this.isPopUpSubmissionVisible=!0,this.isPopUpErrorVisible=!1,!0):(this.isPopUpSubmissionVisible=!1,this.isPopUpErrorVisible=!0,!1)},showPopUp:function(){this.initializeSubmissionPopUp(),this.$refs.popUpContestSubmission.showPopUp()},submitContest:function(a,b,c){if(this.$refs.submissionForm.checkValidity()&&this.checkSubmissionTelephone()){var d=this.submissionTelephone.replace(/[()-.]/g,"");this.isSubmissionLoading=!0;var e=JSON.stringify({PhoneNumber:d,ShortCode:c,TriggerID:b});$.ajax({method:"POST",contentType:"application/json",url:"/global/submitphoneto3c",data:e,dataType:"json",headers:{__RequestVerificationToken:a}}).done(function(a){"OK"===a.status?(this.isPopUpSubmissionVisible=!1,this.isPopUpCompletionVisible=!0):(this.isPopUpSubmissionVisible=!1,this.isPopUpErrorVisible=!0,console.log("ERROR: "),console.log(a.message))}.bind(this)).fail(function(a){this.isPopUpSubmissionVisible=!1,this.isPopUpErrorVisible=!0,console.log("ERROR: "),console.log(a)}.bind(this)).always(function(){this.isSubmissionLoading=!1}.bind(this))}else this.$refs.submissionForm.reportValidity()}},computed:{isSubmissionTelephoneValid:function(){return""!==this.submissionTelephone&&null!==this.submissionTelephone.match(/^[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}$/im)}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Spring2021.VueRoutes"),d=b.resolve("SDM.Vue.Modules.Spring2021.VueComponents");c.Meditations={template:"#module-spring-2021-meditations",name:"RouteMeditations",components:{"video-modal":d.Video}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Util"),e=b.resolve("SDM.Vue.Stores"),f=b.resolve("SDM.Vue.Modules.Spring2021.VueComponents"),g=b.resolve("SDM.Vue.Modules.Spring2021.VueRoutes"),h=b.resolve("SDM.Data.Spring2021");c.Spring2021=function(){var a=new VueRouter({base:"/"+d.getShortLanguageCode()+"/self-care/",mode:"history",routes:[{component:g.Home,name:"RouteHome",path:"/"},{component:g.Products,name:"RouteProducts",path:"/products"},{component:g.ProductsDetail,name:"RouteProductDetail",path:"/products/:productId"},{component:g.Contest,name:"RouteContest",path:"/contest"},{component:g.Meditations,name:"RouteMeditations",path:"/meditations-and-more"}],scrollBehavior:function(a,b){if(!a.query.v&&!b.query.v)return{x:0,y:0}}}),b=new Vuex.Store({state:function(){return{theme:[]}},modules:{storeSelector:e.StoreSelector}});new Vue({components:{hero:f.Hero,navigation:f.Navigation,"footer-menu":f.Footer},el:"#module-spring-2021",methods:Object.assign({},Vuex.mapActions("storeSelector",{setInventories:"setInventories"}),{}),mounted:function(){this.setInventories(h.Inventories.Stores)},router:a,store:b})}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.Summer2021.VueComponents").BadgeCta={computed:{},data:function(){return{}},methods:{},mounted:function(){},props:{badge:{type:Object,default:null}},template:"#module-summer-2021-badge-cta",updated:function(){},watch:{}}}(this,this.jQuery),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.Summer2021.VueComponents").FooterMenu={computed:{},data:function(){return{}},methods:{},mounted:function(){},props:{},template:"#module-summer-2021-footer-menu",updated:function(){},watch:{}}}(this,this.jQuery),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.Summer2021.VueComponents").Hero={template:"#summer-2021-hero-template",props:{baseBackgroundColor:String,featuredBadges:Object,themesModel:Array,ttwBackgroundColor:String},data:function(){return{currentCategory:"",currentSection:"",headerHexColor:"",heroImage:"",heroImageMobile:"",toPath:"",fromPath:"",themeModel:{},isTextToWin:!1}},created:function(){this.updateCurrentSection()},mounted:function(){},methods:{updateCurrentSection:function(){this.$route.path.split("/").filter(String)[0]?this.currentSection=this.$route.path.split("/").filter(String)[0].toLowerCase():this.currentSection="/"}},watch:{$route:function(a,b){this.toPath=a.path,this.fromPath=b.path,this.updateCurrentSection()}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Summer2021.VueComponents"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Data.Summer2021");c.Navigation={template:"#module-summer-2021-navigation",components:{navigation:d.Navigation},data:function(){return{menuLabel:e.MobileMenuLabel,menuOpenLabel:e.MobileMenuOpenLabel,menuCloseLabel:e.MobileMenuCloseLabel,links:[]}},mounted:function(){this.links.push({isAbsolute:!1,label:e.HomeTabLabel,target:"",url:"/"});for(var a=0;a 640?(TweenLite.set(".module-summer-2021-products__filters-container",{height:"auto"}),this.isFiltersActive=!1,this.isFiltersMobile=!1):this.isFiltersMobile||(TweenLite.set(".module-summer-2021-products__filters-container",{height:0}),this.isFiltersActive=!1,this.isFiltersMobile=!0)},getCategoriesFromProducts:function(a){return a.reduce(function(a,b){return b.SubThemes.forEach(function(b){-1===a.findIndex(function(a){return a===b.TitleSlug})&&a.push(b)}),a},[]).map(function(a){return this.categories.find(function(b){if(b.TitleSlug===a)return b})}.bind(this)).sort(function(a,b){return a.Title b.Title?1:0})},showHideFilter:function(){this.isFiltersActive?(TweenLite.to(".module-summer-2021-products__filters-container",.3,{height:0}),this.isFiltersActive=!1):(TweenLite.set(".module-summer-2021-products__filters-container",{height:"auto"}),TweenLite.from(".module-summer-2021-products__filters-container",.3,{height:0}),this.isFiltersActive=!0)},initialize:function(){this.selectedCategories=[]},loadMoreProducts:function(){g.scrollTo$ElementAsync(h(this.$refs.loadMoreButton),500),this.currentPageNumber=this.currentPageNumber+1},updateUrlParam:function(){var a={};this.selectedCategories.length>0&&(a=Object.assign({},a,{categories:this.selectedCategories.join(",")})),this.selectedBrands.length>0&&(a=Object.assign({},a,{brands:this.selectedBrands.join(",")})),console.log(a)}},computed:{filterdProducts:function(){return _.shuffle(this.productsByGroup.filter(function(a){return 0===this.selectedCategories.length||a.SubThemes.reduce(function(a,b){return a||this.selectedCategories.includes(b)}.bind(this),!1)}.bind(this)))},filterdProductsByCategories:function(){return this.productsByGroup.filter(function(a){return 0===this.selectedCategories.length||a.SubThemes.reduce(function(a,b){return a||this.selectedCategories.includes(b)}.bind(this),!1)}.bind(this))},productTiles:function(){return this.filterdProducts.map(function(a){return this.componentKey++,{type:"product",productTile:{cta:{url:a.BuyNowLink?a.BuyNowLink:this.$route.path+"/"+a.Id+window.location.search,urlLabel:a.BuyNowLink?f.BuyNowLabel:f.ProductCTALabel,urlTarget:a.BuyNowLink?"_blank":"_self",isUrlAbsolute:!!a.BuyNowLink},inventory:{stockCountLabel:f.InventoryCountLabel,checkStockCountLabel:f.CheckAvailabilityLabel,checkOtherStockCountlabel:f.CheckOtherStoresLabel},product:{id:a.Id,image:{alt:a.Title+".",url:a.Images&&a.Images.length>0?a.Images[0].ImageRegularDef:""},link:{url:this.$route.path+"/"+a.Id+window.location.search,target:"_self",isAbsolute:!1},tags:a.Tags,title:a.Title,offer:a.OfferShortText}}}},this)},productsByGroup:function(){return Object.keys(this.products).reduce(function(a,b){return this.products[b]&&this.products[b].ProductGroup===this.productGroup&&a.push(this.products[b]),a}.bind(this),[])},inventory:function(){return{stockCountLabel:f.InventoryCountLabel,checkStockCountLabel:f.CheckAvailabilityLabel,checkOtherStockCountlabel:f.CheckOtherStoresLabel}},productGrid:function(){var a=this.currentPageNumber*this.productPerPage;return this.productTiles.slice(0,a)},totalPageNumber:function(){var a=this.productTiles.length;return Math.ceil(a/this.productPerPage)}},watch:{filterdProducts:function(){this.currentPageNumber=1},productsByGroup:function(){this.filteredProductsCategories=this.getCategoriesFromProducts(this.productsByGroup)},productGroup:function(){this.initialize()}}}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules.Summer2021.VueComponents").ShopIcons={template:"#module-summer-2021-shop-icons"}}(this,this.jQuery),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Summer2021.VueComponents"),d=b.resolve("SDM.Vue.Mixins");c.Video={template:"#module-summer-2021-video",props:{videoData:Array},data:function(){return{isModalActive:!1}},mixins:[d.LockFocus],mounted:function(){this.$route.query.v&&this.initVideo(this.$route.query.v)},methods:{initVideo:function(a){var b=this.findObjectByKey(this.videoData,"TitleSlug",a);b&&this.onVideoThumbnailClick(b.YouTubeVideoID,b.Title)},onVideoThumbnailClick:function(a,b){this.isModalActive=!0,document.body.style.overflow="hidden",document.querySelector("#module-summer-2021-video-embed__video").innerHTML='',TweenMax.to(".module-summer-2021-video-embed",.4,{opacity:1}),setTimeout(function(){document.getElementById("module-summer-2021-video-embed__close").focus()},1e3)},onCloseVideo:function(){if(this.isModalActive){var a=this;TweenMax.to(".module-summer-2021-video-embed",.3,{opacity:0,onComplete:a.closeVideo})}},closeVideo:function(){this.isModalActive=!1,document.body.style.overflow="auto",document.querySelector("#module-summer-2021-video-embed__video").innerHTML=""},findObjectByKey:function(a,b,c){for(var d=0;d b;b++)for(var c=0;this.badgeCarousels[b].slides.length>c;c++){var d={api_key:g.PowerReviewsApiKey,locale:g.PowerReviewsLocale,merchant_group_id:g.PowerReviewsMerchantGroupId,merchant_id:g.PowerReviewsMerchantId,page_id:this.badgeCarousels[b].slides[c].id,components:{CategorySnippet:this.badgeCarousels[b].slides[c].pwr.id}};a.push(d)}pwr("render",a)}},components:{badgeCta:c.BadgeCta,carousel:f.ProductCarousel,"store-selector":f.StoreSelector,"video-modal":c.Video},computed:{badgeCarousels:function(){var a=!0;return this.categories.map(function(b){a=!a;var c=b.FeaturedProducts.map(function(a){var c={};return c=""!==a.BuyNowLink?{url:a.BuyNowLink,urlTarget:"_blank",target:"_blank",isUrlAbsolute:!0,isAbsolute:!0}:{url:"/products/"+a.Id+"?themes="+b.ThemeKey,urlTarget:"_self",isUrlAbsolute:!1},{id:a.Id,image:{url:a.Images&&a.Images.length>0?a.Images[0].Url:"",alt:a.Title},inventory:{stockCountLabel:g.InventoryCountLabel,checkStockCountLabel:g.CheckAvailabilityLabel,checkOtherStockCountlabel:g.CheckOtherStoresLabel},link:c,pwr:{id:"pwr-snippet-"+a.Id},text1:a.OfferShortText,text2:a.Title,text3:"",tags:a.Tags}},this);return{badge:{heading:b.CarouselText,hexColorBg:b.CarouselBackgroundHex,hexColorFont:b.CarouselFontHex,hexColorCta:b.FeaturedCarouselButtonBgHex,hexColorCtaLabel:b.CarouselButtonFontHex,text:"",cta:{url:"/products?themes="+b.ThemeKey,label:g.ExploreLabel,isUrlAbsolute:!1}},slides:c,isBadgeOnLeft:!this.isDesktopLarge||a}},this)},hideCategories:function(){this.isCategoriesActive=!1},bottomBadges:function(){return this.bottomBadgesData.map(function(a){return{image:{alt:this.isDesktop||this.isDesktopLarge?a.DesktopImageAltText:a.MobileImageAltText,url:this.isDesktop||this.isDesktopLarge?a.DesktopImage:a.MobileImage},link:{isAbsolute:!1,target:a.CTALinkTarget,url:a.CTALink},youTubeVideoId:a.YouTubeVideoID,youTubeVideoCta:a.TitleSlug}},this)},tileBadges:function(){return this.homeBadges.map(function(a){return{image:{alt:this.isDesktop||this.isDesktopLarge?a.DesktopImageAltText:a.MobileImageAltText,url:this.isDesktop||this.isDesktopLarge?a.DesktopImage:a.MobileImage},link:{label:a.Title,target:a.CTALinkTarget,url:a.CTALink}}},this)}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules.Summer2021.VueRoutes"),d=b.resolve("SDM.Vue.Widgets");c.Contest={template:"#module-summer-2021-route-contest",components:{"pop-up":d.PopUp},props:{},data:function(){return{isPopUpErrorVisible:!1,isPopUpSubmissionVisible:!0,isPopUpCompletionVisible:!1,isPrize1Collapsed:!0,isPrize2Collapsed:!0,isPrize3Collapsed:!0,isSubmissionLoading:!1,submissionTelephone:""}},created:function(){},mounted:function(){},methods:{initializeSubmissionPopUp:function(){this.submissionTelephone="",this.isPopUpSubmissionVisible=!0,this.isPopUpCompletionVisible=!1,this.isPopUpErrorVisible=!1},checkSubmissionTelephone:function(){return this.isSubmissionTelephoneValid?(this.isPopUpSubmissionVisible=!0,this.isPopUpErrorVisible=!1,!0):(this.isPopUpSubmissionVisible=!1,this.isPopUpErrorVisible=!0,!1)},showPopUp:function(){this.initializeSubmissionPopUp(),this.$refs.popUpContestSubmission.showPopUp()},submitContest:function(a,b,c){if(this.$refs.submissionForm.checkValidity()&&this.checkSubmissionTelephone()){var d=this.submissionTelephone.replace(/[()-.]/g,"");this.isSubmissionLoading=!0;var e=JSON.stringify({PhoneNumber:d,ShortCode:c,TriggerID:b});$.ajax({method:"POST",contentType:"application/json",url:"/global/submitphoneto3c",data:e,dataType:"json",headers:{__RequestVerificationToken:a}}).done(function(a){"OK"===a.status?(this.isPopUpSubmissionVisible=!1,this.isPopUpCompletionVisible=!0):(this.isPopUpSubmissionVisible=!1,this.isPopUpErrorVisible=!0,console.log("ERROR: "),console.log(a.message))}.bind(this)).fail(function(a){this.isPopUpSubmissionVisible=!1,this.isPopUpErrorVisible=!0,console.log("ERROR: "),console.log(a)}.bind(this)).always(function(){this.isSubmissionLoading=!1}.bind(this))}else this.$refs.submissionForm.reportValidity()}},computed:{isSubmissionTelephoneValid:function(){return""!==this.submissionTelephone&&null!==this.submissionTelephone.match(/^[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}$/im)}}}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Widgets"),d=b.resolve("SDM.Vue.Modules.Summer2021.VueRoutes"),e=b.resolve("SDM.Data.Summer2021");d.ProductsDetail={data:function(){return{componentKey:0,currentImageIndex:0,isAboutAccordionExpanded:!0,isLegalAccordionExpanded:!1,product:{},relatedProducts:[]}},name:"RouteProductsDetail",template:"#module-summer-2021-route-products-detail",components:{productTile:c.ProductTile,"store-selector-modal":c.StoreSelectorModal},mounted:function(){this.initProducts()},methods:Object.assign({},Vuex.mapActions("storeSelector",["setProductImageUrl","setProductHeading","setProductSubheading","setProductUpc"]),{initProducts:function(){TweenLite.to(".module-summer-2021-route-products-detail",.2,{opacity:0});var a={CampaignTitle:"Summer_2021",CampaignRoute:"summer",Upc:this.$route.params.productId},b=this;$.ajax({method:"POST",url:"/"+e.Lang+"/GetSummer2021ProductDetails",data:a,dataType:"json",headers:{__RequestVerificationToken:e.FormToken}}).done(_.bind(function(a){b.product=a.Product,b.relatedProducts=a.RelatedProducts,TweenLite.to(".module-summer-2021-route-products-detail",.4,{opacity:1,delay:.2})},this)).fail(function(a){console.log(a)})},checkAvailability:function(a){this.setProductImageUrl(a.Images&&a.Images.length>0?a.Images[0].Url:""),this.setProductHeading(a.Title),this.setProductUpc(a.Id),this.popUp.showPopUp()},goBack:function(){this.$router.replace("/"+this.$route.params.category+window.location.search)},toggleAboutAccordian:function(){this.isAboutAccordionExpanded?(TweenLite.to(".module-summer-2021-route-products-detail__accordion-text-wrapper--about",.4,{height:0}),this.isAboutAccordionExpanded=!1):(TweenLite.set(".module-summer-2021-route-products-detail__accordion-text-wrapper--about",{height:"auto"}),TweenLite.from(".module-summer-2021-route-products-detail__accordion-text-wrapper--about",.4,{height:0}),this.isAboutAccordionExpanded=!0)},thumbnailClick:function(a){this.currentImageIndex=a},toggleAccordian:function(a,b){"about"===b?this.isAboutAccordionExpanded?(TweenLite.to(a,.4,{height:0}),this.isAboutAccordionExpanded=!1):(TweenLite.set(a,{height:"auto"}),TweenLite.from(a,.4,{height:0}),this.isAboutAccordionExpanded=!0):"legal"===b&&(this.isLegalAccordionExpanded?(TweenLite.to(a,.4,{height:0}),this.isLegalAccordionExpanded=!1):(TweenLite.set(a,{height:"auto"}),TweenLite.from(a,.4,{height:0}),this.isLegalAccordionExpanded=!0))}}),computed:Object.assign({},Vuex.mapState("storeSelector",["inventories","popUp","selectedStore"]),{relatedProductTiles:function(){return this.relatedProducts.map(function(a){return this.componentKey++,{cta:{url:"/"+this.$route.params.category+"/"+a.Id,urlLabel:e.ProductCTALabel,urlTarget:"_self",isUrlAbsolute:!1},inventory:{stockCountLabel:e.InventoryCountLabel,checkStockCountLabel:e.CheckAvailabilityLabel,checkOtherStockCountlabel:e.CheckOtherStoresLabel},product:{id:a.Id,image:{alt:a.Images&&a.Images.length>0&&a.Images[0].ImageAltText?a.Images[0].ImageAltText:a.Title,url:a.Images&&a.Images.length>0?a.Images[0].Url:""},link:{url:"/"+this.$route.params.category+"/"+a.Id,target:"_self",isAbsolute:!1},tags:a.Tags,title:a.Title,offer:a.OfferShortText}}},this)}}),watch:{$route:function(){this.initProducts()}}}}(this),function(a){"use strict";var b=a.NR,c=SDM.Data.Summer2021,d=b.resolve("SDM.Vue.Modules.Summer2021.VueComponents"),e=b.resolve("SDM.Vue.Modules.Summer2021.VueRoutes"),f=b.resolve("SDM.Vue.Mixins"),g=b.resolve("SDM.Vue.Widgets");e.SummerSwitchUp={template:"#module-summer-2021-route-summer-switch-up",mixins:[f.Responsive],components:{"store-selector":g.StoreSelector,"products-grid":d.Products,"video-modal":d.Video},data:function(){return{themeData:{}}},created:function(){this.themeData=this.findObjectByKey(c.TabsJson,"ThemeKey","summer-switch-up")},methods:{findObjectByKey:function(a,b,c){for(var d=0;d 0&&c(this.$refs.carouselProduct).slick({infinite:!0,lazyLoad:"ondemand",slidesToScroll:1,slidesToShow:4,responsive:[{breakpoint:769,settings:{slidesToShow:2,swipeToSlide:!0}},{breakpoint:480,settings:{slidesToShow:1,swipeToSlide:!0}}]})},initializeCarouselShare:function(){c(this.$refs.carouselShare).length>0&&(console.log("Carousel called"),c(this.$refs.carouselShare).on("afterChange",function(){this.currentSocialBadgeIndex=c(this.$refs.carouselShare).slick("slickCurrentSlide")}.bind(this)),c(this.$refs.carouselShare).slick({infinite:!0,lazyLoad:"ondemand",slidesToScroll:1,slidesToShow:1,responsive:[{breakpoint:769,settings:{slidesToShow:1,swipeToSlide:!0}}]}))},initializeSocial:function(){POWERREVIEWS.display.render({api_key:"f40b12ae-7efa-423a-8f12-cb902debf1c0",locale:"en_CA",merchant_id:"867678",irlSubtype:"XL",components:{IRLSnippet:"module-shoebox__social"}})},setDonationAmount:function(a,b){var e=parseFloat(a)>0?a:"",f=parseInt(b)>0?b:"";this.setMoneyAmount(e),localStorage.setItem("donationMoneyAmount",e),this.setPcOptimumAmount(f),localStorage.setItem("donationPointsAmount",f),this.activeDonationStep++,d.scrollTo$ElementAsync(c(this.$refs.sectionDonate),500,this.navHeight)}}),mounted:function(){this.initializeCarousel(),this.initializeSocial();var a=d.getUrlVars();a&&"points"===a.type?this.goToDonationStep(2):a&&"introduction"===a.step&&this.goToDonationStep(1),this.socialBadges.forEach(function(a){this.fetchBadgeDataUrl(a)}.bind(this))},store:a,watch:{activePanel:function(a){a===this.panels.completion?this.showDonationCompletion=!0:a===this.panels.confirmation?(this.activeDonationStep=3,this.totalDonationSteps=3):a===this.panels.points||a===this.panels.pcoptimum||a===this.panels.money?(this.activeDonationStep=2,this.totalDonationSteps=3):this.activeDonationStep=1},showDonationCompletion:function(){var a=this;setTimeout(function(){a.initializeCarouselShare()},50)}}})}}(this),function(a){var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Util");c.StickyNavigation=function(){new Vue({data:function(){return{isNavActive:!1,isNavSticky:!1}},el:"#module-sticky-navigation",methods:{onResize:function(){this.headerHeight=this.$refs.navLogo.clientHeight,this.stickHeader()},onScroll:function(){this.stickHeader()},stickHeader:function(){var a=d.getHeaderBarHeight(),b=window.pageYOffset||document.documentElement.scrollTop;Math.max(document.documentElement.clientWidth,window.innerWidth||0)<=960&&(a=0),this.isNavSticky=b>=a},toggleNav:function(){this.isNavActive=!this.isNavActive,this.isNavActive?document.body.style.overflow="hidden":document.body.style.overflow="visible",this.stickHeader()},toggleNavOff:function(){this.isNavActive=!1,document.body.style.overflow="visible",this.stickHeader()},isNavUrlActive:function(a){return new URL(a,window.location.origin).pathname===window.location.pathname}},mounted:function(){this.headerHeight=this.$refs.navLogo.clientHeight,window.addEventListener("scroll",this.onScroll),window.addEventListener("resize",_.debounce(this.onResize,100))}})}}(this),function(a){var b=a.NR,c=b.resolve("SDM.Core.Modules"),d=b.resolve("SDM.Util");c.ArticleDetails=function(a){new Vue({components:{},created:function(){},data:function(){return{}},el:a,methods:{shareFacebook:function(){FB.ui({display:"popup",href:window.location.href,method:"share"})}},mounted:function(){if(d.getUrlVars().parentUrl&&window.history.replaceState({},document.title,window.location.pathname),this.$refs.productsCarousel){var a=this.$refs.productsCarousel.children.length||0;a<=2||$(this.$refs.productsCarousel).slick({nextArrow:'',prevArrow:'',responsive:[{breakpoint:769,settings:{slidesToShow:Math.min(a,2)}}],slidesToShow:Math.min(a,4)})}},watch:{}})}}(this),function(a){var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Util");c.StickyPromotionBar=function(){new Vue({data:function(){return{isNavSticky:!1}},el:"#module-sticky-promotion-bar",methods:{onResize:function(){this.stickHeader()},onScroll:function(){this.stickHeader()},stickHeader:function(){var a=d.getHeaderBarHeight(),b=window.pageYOffset||document.documentElement.scrollTop;Math.max(document.documentElement.clientWidth,window.innerWidth||0)<=960&&(a=0),this.isNavSticky=b>=a},toggleNav:function(){this.isNavActive=!this.isNavActive,this.isNavActive?document.body.style.overflow="hidden":document.body.style.overflow="visible",this.stickHeader()},toggleNavOff:function(){this.isNavActive=!1,document.body.style.overflow="visible",this.stickHeader()},isNavUrlActive:function(a){return new URL(a,window.location.origin).pathname===window.location.pathname}},mounted:function(){window.addEventListener("scroll",this.onScroll),window.addEventListener("resize",_.debounce(this.onResize,100))}})}}(this),function(a){var b=a.NR,c=b.resolve("SDM.Vue.Modules.WomensHealth.VueComponents"),d=a._,e=a.$;c.Carousel={beforeDestroyed:function(){var b=e(a);b.off("becometonarrow becometowide",this.boundOnBecomeToNarrow),b.off("becometosmalldesktopwide becometoextrawide",this.boundOnBecomeToWide),b.off("resize",this.boundOnResize)},computed:{canMoveLeft:function(){return this.offsetLeftFactor>0},canMoveRight:function(){return this.offsetLeftFactor =0},isMoneyAmountValid:function(){var a=/^[1-9]\d*$/;return""!==this.moneyAmount&&this.moneyAmount>=parseFloat(e.MinimumDollarAmount)&&this.moneyAmount.search(a)>=0},isPCOptimumAmountValid:function(){var a=/^[1-9]\d*$/;return""!==this.pcOptimumAmount&&this.pcOptimumAmount>=parseFloat(e.MinimumPointAmount)&&this.pcOptimumAmount.search(a)>=0},isTreeModalVisible:function(){return(this.isWelcomeModalVisible||this.isTreeDetailModalVisible)&&this.activeTreeStep===this.treeSteps.growingTree&&!this.isDonationStepVisible}}),directives:{focus:{inserted:function(a){a.focus()}}},data:function(){return{activeAvatar:null,activeAvatarPlayer:null,activeDonationStep:1,activeDonationAmountStep:"",activeModalPartnerDetail:null,activeModalShelterDetail:null,activeTreeStep:"",address:{firstName:"",lastName:"",email:"",address1:"",address2:"",city:"",province:"",postalCode:""},avatars:e.Avatars,branches:e.Branches,donationLocation:"",donationName:"",donationTypes:{money:"money",points:"points"},isDonationLocationDropdownActive:!1,isLoaderVisible:!1,isPCOptimumErrorVisible:!1,isTreeDetailModalVisible:!1,isWelcomeModalVisible:!0,donationSteps:{amount:1,personalize:2,preview:3,confirmation:4},donationAmountSteps:{introduction:"introduction",points:"points",money:"money",pcoptimum:"pcoptimum",address:"address",confirmation:"confirmation",completion:"completion"},moneyAmount:"",partners:e.Partners,pcOptimumAmount:"",pcOptimumPointsPerDollar:1e3,selectedDonationType:"",shelters:e.Shelters,signature:"",tree:e.Tree,treeSteps:{growingTree:"growingTree",community:"community"}}},methods:Object.assign({},Vuex.mapActions("womensHealth",["setIsDonationStepVisible","setIsRedirectingModalStep"]),{checkDonationName:function(){this.isNameValid?this.$refs.formDonationName.setCustomValidity(""):this.$refs.formDonationName.setCustomValidity(e.InitialsErrorMessage)},clickOutside:function(){this.activeDonationStep===this.donationSteps.confirmation&&this.initializeData()},completeDonation:function(){this.initializeData(),this.setIsDonationStepVisible(!1)},convertDonationNameToUppercase:function(){this.donationName=this.donationName.toUpperCase()},formatToCurrency:function(a){var b=d.getShortLanguageCode(),c=parseFloat(a).toFixed(2).split("."),e=c[0],f=c[1];return"en"===b?"$"+(e=e.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"))+"."+f:"fr"===b?(e=e.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1 "))+","+f+" $":void 0},donatePCOptimumPoints:function(){this.isLoaderVisible=!0,$.ajax({context:this,data:{points:this.pcOptimumAmount},method:"POST",url:"/Brooklyn/Donate"}).done(function(a,b){"success"===b&&"202"===a?this.activeDonationAmountStep=this.donationAmountSteps.completion:(this.isPCOptimumErrorVisible=!0,console.log("ERROR:"+a))}).fail(function(a){console.log(a),this.isPCOptimumErrorVisible=!0}).always(function(){this.isLoaderVisible=!1})},getFormDataAsObject:function(a){for(var b=$(a).serializeArray(),c={},d=0;d 57)&&46!==b&&8!==b&&a.preventDefault()},onDonationNextClick:function(){this.isDonationStepVisible&&(this.activeDonationStep===this.donationSteps.amount?this.activeDonationAmountStep===this.donationAmountSteps.introduction?this.selectedDonationType===this.donationTypes.points?this.activeDonationAmountStep=e.IsLoggedIn?this.donationAmountSteps.points:this.donationAmountSteps.pcoptimum:this.selectedDonationType===this.donationTypes.money&&(this.activeDonationAmountStep=this.donationAmountSteps.money):this.activeDonationAmountStep===this.donationAmountSteps.points?this.donatePCOptimumPoints():this.activeDonationAmountStep===this.donationAmountSteps.money?this.activeDonationAmountStep=this.donationAmountSteps.address:this.activeDonationAmountStep===this.donationAmountSteps.address?this.submitPayment():this.activeDonationAmountStep===this.donationAmountSteps.completion&&(this.activeDonationStep+=1):this.activeDonationStep===this.donationSteps.preview?(this.checkDonationName(),this.$refs.formDonationPreview.checkValidity()?this.submitGivingTreeDonation():this.$refs.formDonationPreview.reportValidity()):this.activeDonationStep+=1)},onDonationPreviousClick:function(){this.isDonationStepVisible&&(this.activeDonationStep===this.donationSteps.amount?this.activeDonationAmountStep===this.donationAmountSteps.introduction?this.setIsDonationStepVisible(!1):this.activeDonationAmountStep===this.donationAmountSteps.points?this.activeDonationAmountStep=this.donationAmountSteps.introduction:this.activeDonationAmountStep===this.donationAmountSteps.money?this.activeDonationAmountStep=this.donationAmountSteps.introduction:this.activeDonationAmountStep===this.donationAmountSteps.pcoptimum?this.activeDonationAmountStep=this.donationAmountSteps.introduction:this.activeDonationAmountStep===this.donationAmountSteps.address?this.activeDonationAmountStep=this.donationAmountSteps.money:this.activeDonationAmountStep===this.donationAmountSteps.confirmation&&(this.activeDonationAmountStep=this.donationAmountSteps.address):this.activeDonationStep-=1)},pauseAvatar:function(a,b){this.activeAvatar&&this.activeAvatar.AvatarID===b||a.target.pause()},playAvatar:function(a,b){this.activeAvatar&&this.activeAvatar.AvatarID===b||a.target.play()},clearUrlParams:function(){var a="";a=-1===window.location.href.indexOf("?")?window.location.href:window.location.href.slice(0,window.location.href.indexOf("?")),history.pushState&&window.history.pushState("",null,a)},setActiveAvatar:function(a,b){null!==this.activeAvatarPlayer&&this.activeAvatarPlayer.pause(),this.activeAvatarPlayer="lottie-player"===a.target.tagName.toLowerCase()?a.target:a.target.querySelectorAll("lottie-player")[0],this.activeAvatarPlayer.play(),this.activeAvatar=b},submitPayment:function(){this.$refs["form-address"].checkValidity()?(this.activeDonationAmountStep=this.donationAmountSteps.confirmation,Vue.nextTick(function(){this.getFrontStreamUrl()}.bind(this))):this.$refs["form-address"].reportValidity()},submitGivingTreeDonation:function(){this.isLoaderVisible=!0,$.ajax({context:this,data:{Initials:this.formattedDonationName,AvatarID:this.activeAvatar.AvatarID,DonationAmount:this.selectedDonationType===this.donationTypes.money?this.moneyAmount:this.pcOptimumAmount,DonationType:this.selectedDonationType===this.donationTypes.money?"d":"p",Location:this.donationLocation},headers:{__RequestVerificationToken:e.VerificationToken},method:"POST",url:"/WomensHealth/Submit"}).done(function(a,b){"success"===b?(this.tree.unshift(a),this.activeDonationStep+=1):console.log("ERROR:"+a)}).fail(function(a){console.log(a)}).always(function(){this.isLoaderVisible=!1})},hidePopUp:function(){this.$root.$emit("pop-up-closed-footer")},checkKeyEvent:function(a){if("Escape"===a.key)return this.isTreeDetailModalVisible=!1,void(this.isWelcomeModalVisible=!1);var b=this.$refs.modalContainer.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(b.length<2&&"Tab"===a.key)return void a.preventDefault();var c=b.length-1;"Tab"===a.key&&!1===a.shiftKey&&a.target===b[c]?(a.preventDefault(),b[0].focus()):"Tab"===a.key&&!0===a.shiftKey&&a.target===b[0]&&(a.preventDefault(),b[c].focus())}}),mounted:function(){this.activeTreeStep=this.treeSteps.growingTree,this.activeDonationStep=this.donationSteps.amount,this.activeDonationAmountStep=this.donationAmountSteps.introduction,window.addEventListener?window.addEventListener("message",function(a){e&&e.FrontStreamUrl&&e.FrontStreamUrl.includes(a.origin)&&("userCancelled"===a.data?this.activeDonationAmountStep=this.donationAmountSteps.address:(this.activeDonationStep=this.donationSteps.personalize,this.activeDonationAmountStep="",this.donationLocation=this.address.province))}.bind(this)):window.attachEvent&&window.attachEvent("onmessage",function(a){e&&e.FrontStreamUrl&&e.FrontStreamUrl.includes(a.origin)&&("userCancelled"===a.data?this.activeDonationAmountStep=this.donationAmountSteps.address:(this.activeDonationStep=this.donationSteps.personalize,this.activeDonationAmountStep="",this.donationLocation=this.address.province))}.bind(this))},name:"GivingTree",template:"#module-womens-health-giving-tree",watch:{isRedirectingModalStep:function(a){if(!0===a){var b=d.getUrlVars();b&&"points"===b.type&&(e.IsLoggedIn?(this.selectedDonationType=b.type,this.activeDonationAmountStep=this.donationAmountSteps.points):this.activeDonationAmountStep=this.donationAmountSteps.pcoptimum),this.setIsRedirectingModalStep(!1),this.clearUrlParams()}},isTreeModalVisible:function(a){a&&this.$nextTick(function(){this.$refs.modalContainer.focus()})}}}}(this),function(a){var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Util"),e=b.resolve("SDM.Vue.Modules.WomensHealth.VueComponents"),f=b.resolve("SDM.Vue.Widgets"),g=a.localStorage,h=b.resolve("SDM.Data.WomensHealth"),i=a._,j=a.$,k=function(a){if(!a)return null;try{var b=a.match(/href="([^"]*)"/i);if(!b||!b.length)return null;var c=a.match(/^<[^>]*>([^<]*)<\/a>$/i);if(!c||!c.length)return null;var d=a.match(/target="([^"]*)"/i);return{href:b[1],target:d&&d.length?d[1]:"",text:c[1]}}catch(b){return console.error("Could not parse URL:",a,b),null}};c.WomensHealth=function(){var a=new Vuex.Store({modules:{womensHealth:{actions:{setIsDonationStepVisible:function(a,b){a.commit("setIsDonationStepVisible",b)},setIsRedirectingModalStep:function(a,b){a.commit("setIsRedirectingModalStep",b)}},mutations:{setIsDonationStepVisible:function(a,b){a.isDonationStepVisible=b},setIsRedirectingModalStep:function(a,b){a.isRedirectingModalStep=b}},namespaced:!0,state:function(){return{isDonationStepVisible:!1,isRedirectingModalStep:!1}}}}});new Vue({components:{carousel:e.Carousel,"giving-tree":e.GivingTree,"pop-up":f.PopUp},computed:Object.assign({},Vuex.mapState("womensHealth",["isRedirectingModalStep"]),{}),created:function(){this.charitiesByProvinceId=i.reduce(this.partners,function(a,b){var c=(b.Province||"").toLowerCase();return c?(a[c]||(a[c]=[]),a[c].push({imageUrl:(b.Image||{}).URL,label:b.Title,url:k(b.Url)}),a):a},{}),this.shelters.length&&(this.featuredShelter={body:this.shelters[0].LongDescription||"",imageUrl:(this.shelters[0].LargeLogo||{}).URL||"",name:this.shelters[0].Name||""}),this.geoLocateUser()},data:function(){return{charitiesByProvinceId:{},charitiesWithImages:[],testimonials:h.Testimonials,charitiesWithoutImages:[],featuredShelter:null,isShowAdditionalCharities:!1,partners:h.Partners,selectedProvinceId:"",shelters:h.Shelters,socialBadges:i.map(i.filter(h.SocialImages||[],function(a){return Boolean(a.URL)}),function(a){return{downloadLink:{href:a.URL,target:"_blank"},label:a.Label||"",imageUrl:a.URL}})}},el:"#module-womens-health",methods:Object.assign({},Vuex.mapActions("womensHealth",["setIsDonationStepVisible","setIsRedirectingModalStep"]),{geoLocateUser:function(){var a=new j.Deferred;navigator&&navigator.geolocation?navigator.geolocation.getCurrentPosition(function(b){b&&b.coords&&b.coords.latitude&&b.coords.longitude?a.resolve({lat:b.coords.latitude,lng:b.coords.longitude}):a.reject("Failed to get lat/lng data")},function(b){console.error(b),a.reject("Failed to get response from navigator.geolocation")}):a.reject("No navigator.geolocation api"),j.when(a.promise()).then(function(a){return d.getProvinceId(a)}).then(i.bind(function(a){this.selectedProvinceId=a},this)).fail(function(a){console.error(a)})},showAdditionalCharities:function(){this.isShowAdditionalCharities=!0},showTreeModal:function(a){this.setIsDonationStepVisible(a),this.$refs.popUpTreeModal.showPopUp(),this.isRedirectingModalStep||g.removeItem("donationMoneyAmount"),this.$refs.givingTree.$refs.modalContainerCloseBtn&&this.$refs.givingTree.$refs.modalContainerCloseBtn.focus()}}),mounted:function(){var a=d.getUrlVars();a&&"points"===a.type&&(this.setIsRedirectingModalStep(!0),this.showTreeModal(!0))},store:a,watch:{selectedProvinceId:function(){var a=d.getShortLanguageCode(),b=i.reduce(this.charitiesByProvinceId[this.selectedProvinceId]||[],function(a,b){return Boolean(b.imageUrl)?a.withImages.push(b):a.withoutImages.push(b),a},{withImages:[],withoutImages:[]});b.withoutImages.length&&b.withImages.push({clickEvent:"view-all",label:"fr"===a?"Tout voir":"View All Charities",imageUrl:"/static/campaigns/womens-health/images/view-all-charities_"+("fr"===a?"fr":"en")+".png"}),this.charitiesWithImages=b.withImages,this.charitiesWithoutImages=b.withoutImages.sort(function(a,b){return a.label b.label?1:0}),this.isShowAdditionalCharities=!1}}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Util");c.GlobalCtaList=function(a){var c=a.data("contentId"),f=b.resolve("SDM.Data.GlobalCTAList")[c],g=b.resolve("SDM.Vue.Vuex");g.hasModule("provinceSelector")||g.registerModule("provinceSelector",d.ProvinceSelector),new Vue({computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{}),data:function(){return{badges:f.Badges,sdmLocationProvinceId:""}},el:a[0],methods:{},mounted:function(){var a=JSON.parse(e.getValueFromCookie("sdm-location"));this.sdmLocationProvinceId=a&&a.province?a.province:""},store:g})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Widgets");c.FeaturedProductsCarousel=function(a){var c=b.resolve("SDM.Vue.Vuex");c.hasModule("storeSelector")||c.registerModule("storeSelector",d.StoreSelector),new Vue({el:"#"+a[0].id,store:c,components:{carousel:e.ProductCarousel,"store-selector":e.StoreSelector},props:{dataProducts:String},data:function(){return{categoryCarouselsSlidesToShow:{desktop:5,tablet:3,mobileLarge:2,mobile:2},products:[],showInventory:!1,checkAvailabilityLabel:"",checkOtherStoresLabel:"",detailsButtonLabel:"",inStoreLabel:"",ourStockLabel:"",shopButtonLabel:""}},mounted:function(){this.products=JSON.parse(this.$el.attributes["data-products"].value),this.checkAvailabilityLabel=this.$el.attributes["data-check-availability-label"].value,this.checkOtherStoresLabel=this.$el.attributes["data-check-other-stores-label"].value,this.detailsButtonLabel=this.$el.attributes["data-details-button-label"].value,this.inStoreLabel=this.$el.attributes["data-in-store-label"].value,this.ourStockLabel=this.$el.attributes["data-our-stock-label"].value,this.shopButtonLabel=this.$el.attributes["data-shop-button-label"].value,this.showInventory="False"===this.$el.attributes["data-hide-inventory"].value,this.showInventory&&this.setInventories(JSON.parse(this.$el.attributes["data-inventories"].value).Stores)},methods:Object.assign({},Vuex.mapActions("storeSelector",{setInventories:"setInventories"}),{}),computed:Object.assign({},Vuex.mapState("storeSelector",["inventories","popUp","selectedStore"]),{productsCarousel:function(){return{slides:this.products.map(function(a){var b={};return this.showInventory&&(b={stockCountLabel:this.inStoreLabel,checkStockCountLabel:this.checkAvailabilityLabel,checkOtherStockCountlabel:this.checkOtherStoresLabel,ourStockLabel:this.ourStockLabel}),{id:a.UpcStripped,image:{url:a.ImageUrl,alt:a.Title},cta:{isAbsolute:!0,label:a.UseBuyNowLabel?this.shopButtonLabel:this.detailsButtonLabel,target:a.ProductCTATarget,url:a.ProductCTA},link:{isAbsolute:!0,target:a.ProductCTATarget,url:a.ProductCTA},inventory:b,hasBuyNowLink:a.UseBuyNowLabel,text1:a.Brand,text2:a.Title,text3:a.Tag,title:a.Title}},this)}}}),watch:{}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Util"),e=b.resolve("SDM.Vue.Mixins"),f=b.resolve("SDM.Vue.Stores"),g=b.resolve("SDM.Vue.Widgets");c.DietitionNavigation=function(a){var c=a.data("contentId"),h=b.resolve("SDM.Data.DietitianNavigation")[c],i=b.resolve("SDM.Vue.Vuex");i.hasModule("provinceSelector")||i.registerModule("provinceSelector",f.ProvinceSelector),new Vue({el:a[0],mixins:[e.Responsive],created:function(){}, components:{"province-selector":g.ProvinceSelector},computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{filteredSlides:function(){return this.slides.filter(function(a){return a.provinces.includes(this.userProvinceId)}.bind(this))}}),data:function(){return{slides:h.Slides}},methods:{isUrlActive:function(a){var b=new URL(a,window.location.origin),c=b.pathname.split("/"+d.getShortLanguageCode()).pop();return window.location.pathname.split("/"+d.getShortLanguageCode()).pop()===c}},mounted:function(){},store:i,watch:{filteredSlides:function(){this.$refs.carousel&&(this.$refs.carousel.hasOwnProperty("slick")&&$(this.$refs.carousel).slick("unslick"),Vue.nextTick(function(){$(this.$refs.carousel).slick({arrows:!1,autoplay:!0,dots:!0})}.bind(this)))}}}),$(".module-dietitian-navigation__region-expand").on("click",function(){$("#module-dietitian-navigation__region-expand").hasClass("module-dietitian-navigation__region-expand--open")?setTimeout(function(){$("#module-dietitian-navigation__region-expand").removeClass("module-dietitian-navigation__region-expand--open"),$(".module-dietitian-navigation__region-expanded").removeClass("module-dietitian-navigation__region-expanded--open")},10):($(".module-dietitian-navigation__region-expanded").addClass("module-dietitian-navigation__region-expanded--open"),$("#module-dietitian-navigation__region-expand").addClass("module-dietitian-navigation__region-expand--open"))}),$(".module-dietitian-navigation__menu-mobilebutton").on("click",function(){$("#module-dietitian-navigation__header-nav").hasClass("module-dietitian-navigation__header-nav--open")?setTimeout(function(){$("#module-dietitian-navigation__header-nav").removeClass("module-dietitian-navigation__header-nav--open"),$(".module-dietitian-navigation__menu-hamburger").removeClass("module-dietitian-navigation__menu-hamburger--open")},10):($(".module-dietitian-navigation__menu-hamburger").addClass("module-dietitian-navigation__menu-hamburger--open"),$("#module-dietitian-navigation__header-nav").addClass("module-dietitian-navigation__header-nav--open"))}),$(".module-dietitian-navigation__recipe-btn").on("click",function(a){$(".module-dietitian-navigation__recipenav").hasClass("module-dietitian-navigation__recipenav--open")?($(".module-dietitian-navigation__recipenav").removeClass("module-dietitian-navigation__recipenav--open"),$(".downarrow").removeClass("downarrow--open"),$(".module-dietitian-navigation__recipe-expand").attr("aria-expanded","false")):($(".module-dietitian-navigation__recipenav").addClass("module-dietitian-navigation__recipenav--open"),$(".downarrow").addClass("downarrow--open"),$(".module-dietitian-navigation__recipe-expand").attr("aria-expanded","true"),a.preventDefault())}),$(document).on("click",function(a){$(a.target).closest(".module-dietitian-navigation__recipe-btn").length||($(".module-dietitian-navigation__recipenav").removeClass("module-dietitian-navigation__recipenav--open"),$(".downarrow").removeClass("downarrow--open"),$(".module-dietitian-navigation__recipe-expand").attr("aria-expanded","false"))})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Mixins");c.DietitionBiography=function(){var a=b.resolve("SDM.Vue.Vuex");a.hasModule("provinceSelector")||a.registerModule("provinceSelector",VueStores.ProvinceSelector),new Vue({el:"#module-dietitian-biography",computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{}),data:function(){return{}},mixins:[d.Responsive],mounted:function(){},store:a,updated:function(){$("#module-dietitian-biography .module-dietitian-biography__bio-entry").length<1&&$("#module-dietitian-biography").hide()}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Data.DietitionSocialFeed");c.DietitionSocialFeed=function(){new Vue({el:"#module-dietitian-socialfeed",methods:{initSocial:function(){POWERREVIEWS.display.render({api_key:d.ApiKey,locale:d.Locale,merchant_id:d.MerchantID,CD4_IRL_IMAGE_GALLERY_STYLE:d.GalleryStyle,components:{IRLSnippet:"module-dietitian-socialfeed__social"}})}},mounted:function(){this.initSocial()}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Widgets");c.FeaturedProductsCarouselWithBadge=function(a){var c=a.data("contentId"),f=b.resolve("SDM.Data.FeaturedProductsCarouselWidthBadges")[c],g=b.resolve("SDM.Vue.Vuex");g.hasModule("storeSelector")||g.registerModule("storeSelector",d.StoreSelector),new Vue({el:a[0],store:g,components:{carousel:e.ProductCarousel,"store-selector":e.StoreSelector},props:{dataProducts:String},data:function(){return{badgeRightAligned:!1,carouselSlides:[],categoryCarouselsSlidesToShow:{desktop:3,tablet:2,mobileLarge:2,mobile:2},checkAvailabilityLabel:"",checkOtherStoresLabel:"",detailsButtonLabel:"",inStoreLabel:"",ourStockLabel:"",products:[],shopButtonLabel:"",showInventory:!1}},mounted:function(){this.products=JSON.parse(f.Products),this.badgeRightAligned="True"===f.BadgeRightAligned,this.checkAvailabilityLabel=f.CheckAvailabilityLabel,this.checkOtherStoresLabel=f.CheckOtherStoresLabel,this.inStoreLabel=f.InStoreLabel,this.showInventory="False"===f.HideInventory,this.showInventory&&this.setInventories(JSON.parse(f.Inventory).Stores),this.initCarouselSlides();var a=this;setTimeout(function(){a.initPowerReviewSnippet()},3e3)},methods:Object.assign({},Vuex.mapActions("storeSelector",{setInventories:"setInventories"}),{initCarouselSlides:function(){this.carouselSlides=this.products.map(function(a){var b={};return this.showInventory&&(b={stockCountLabel:this.inStoreLabel,checkStockCountLabel:this.checkAvailabilityLabel,checkOtherStockCountlabel:this.checkOtherStoresLabel}),{id:a.UpcStripped,image:{url:a.ImageUrl,alt:a.Title},link:{isAbsolute:!0,target:a.ProductCTATarget,url:a.ProductCTA},inventory:b,InventoryHightlightColor:f.InventoryHighlightColor,InventoryIcon:f.InventoryIcon,hasBuyNowLink:a.UseBuyNowLabel,pwr:{id:"pw-snippet-"+c+a.ID,apiKey:f.PwrApiKey,merchantId:f.PwrMerchantId,merchantGroupId:f.PwrMerchantGroupId,locale:f.PwrLocale},text2:a.Title,text3:a.Tag,title:a.Title}},this)},initPowerReviewSnippet:function(){for(var a=this,b=0;this.carouselSlides.length>b;b++)null!==this.carouselSlides[b].pwr&&pwr("render",{api_key:a.carouselSlides[b].pwr.apiKey,locale:a.carouselSlides[b].pwr.locale,merchant_group_id:a.carouselSlides[b].pwr.merchantGroupId,merchant_id:a.carouselSlides[b].pwr.merchantId,page_id:a.carouselSlides[b].id,components:{CategorySnippet:a.carouselSlides[b].pwr.id}})}}),computed:Object.assign({},Vuex.mapState("storeSelector",["inventories","popUp","selectedStore"]),{carouselBadge:function(){return{heading:f.BadgeText,hexColorBg:f.BadgeBackgroundColorHex,hexColorFont:f.BadgeTextColorHex,hexColorCtaLabel:f.BadgeButtonLabelColorHex,hexColorCtaBg:f.BadgeButtonColorHex,text:"",cta:{url:f.BadgeButtonUrl,label:f.BadgeButtonLabel,urlTarget:f.BadgeButtonUrlTarget}}}})})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Data.TwoLevelNavigationMenu"),e=b.resolve("SDM.Util");c.TwoLevelNavigationMenu=function(a){new Vue({el:a[0],data:function(){return{currentPath:"",isNavActive:!1,links:[],menuLabel:"Menu",menuOpenLabel:"Open",menuCloseLabel:"Close"}},created:function(){this.menuItems=JSON.parse(d.MenuItems)},mounted:function(){this.currentPath=window.location.pathname},methods:{toggleNav:function(){this.isNavActive=!this.isNavActive,this.isNavActive?(document.body.style.overflow="hidden",e.scrollTo$ElementAsync($(this.$el),500)):document.body.style.overflow="visible"},toggleNavOff:function(){this.isNavActive=!1,document.body.style.overflow="visible"}}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Vue.Mixins"),f=b.resolve("SDM.Vue.Stores"),g=b.resolve("SDM.Data.ProductListingWithFeatureFilter"),h=b.resolve("SDM.Util");c.ProductListingWithFeatureFilter=function(a){var c=b.resolve("SDM.Vue.Vuex");c.hasModule("storeSelector")||c.registerModule("storeSelector",f.StoreSelector),new Vue({el:a[0],components:{"product-tile":d.ProductTile,"store-selector":d.StoreSelector},store:c,mixins:[e.Responsive],data:function(){return{componentKey:0,currentPageNumber:0,filteredProductsBrands:[],filteredProductsCategories:[],filteredProductsFeatures:[],isFiltersActive:!1,isFiltersMobile:!1,isFeatureFilterActive:!1,isLoading:!1,products:{},productGrid:[],routeBrands:"",routeCategories:"",routeFeatures:"",screenWidth:0,selectedBrands:[],selectedCategories:[],selectedFeatures:[],showInventory:!1,totalProductCount:0}},created:function(){this.showInventory="False"===g.InventoryHide,this.showInventory&&this.setInventories(JSON.parse(g.Inventory).Stores)},mounted:function(){this.getUrlVars(),this.routeBrands&&this.routeBrands.split(",").forEach(function(a){this.selectedBrands.push(a)},this),this.routeCategories&&this.routeCategories.split(",").forEach(function(a){this.selectedCategories.push(a)},this),this.routeFeatures&&this.routeFeatures.split(",").forEach(function(a){this.selectedFeatures.push(a)},this),this.getProducts(),window.addEventListener("resize",_.debounce(this.onResize,50)),this.onResize()},methods:Object.assign({},Vuex.mapActions("storeSelector",{setInventories:"setInventories"}),{getUrlVars:function(){this.routeBrands=h.getUrlVars().brands,this.routeCategories=h.getUrlVars().categories,this.routeFeatures=h.getUrlVars().features},getProducts:function(){this.isLoading=!0;var a={productListID:g.ProductListingId,randomize:g.RandomizeProducts,ppp:g.ProductsPerPage,pageNumber:this.currentPageNumber,brandFilters:this.routeBrands,categoryFilters:this.routeCategories,featureFilters:this.routeFeatures};$.ajax({method:"GET",url:"/"+g.Lang+"/product/GetFilteredProducts",data:a,dataType:"json",headers:{__RequestVerificationToken:g.FormToken}}).done(_.bind(function(a){this.currentPageNumber>0?this.products=this.products.concat(a.Products):this.products=a.Products,this.initFilters({categoryFilters:a.CatgoryFilters,brandFilters:a.BrandFilters,featureFilters:a.FeatureFilters}),this.totalProductCount=a.TotalProductCount,this.initProductGrid(),this.isLoading=!1},this)).fail(function(a){console.log(a)})},onBrandsFilterChange:function(){var a=this.selectedBrands.filter(function(a){return this.filteredProductsBrands.findIndex(function(b){return b.TitleSlug===a})>=0}.bind(this));this.selectedBrands.length!==a.length&&(this.selectedBrands=a),this.updateUrlParam()},onCategoriesFilterChange:function(){var a=this.selectedCategories.filter(function(a){return this.filteredProductsCategories.findIndex(function(b){return b.TitleSlug===a})>=0}.bind(this));this.selectedCategories.length!==a.length&&(this.selectedCategories=a),this.updateUrlParam()},onFeaturesFilterChange:function(){var a=this.selectedFeatures.filter(function(a){return this.filteredProductsFeatures.findIndex(function(b){return b.TitleSlug===a})>=0}.bind(this));this.selectedFeatures.length!==a.length&&(this.selectedFeatures=a),this.updateUrlParam()},initProductGrid:function(){this.productGrid=this.products.map(function(a){return this.componentKey++,{type:"product",productTile:{cta:{bgColor:g.ColorPrimary?g.ColorPrimary:"#CB333B",url:a.BuyNowLink?a.BuyNowLink:"",urlLabel:a.BuyNowLink?g.ProductButtonLabel:g.ProductCTALabel,urlTarget:a.BuyNowLink?"_blank":"_self",isUrlAbsolute:!!a.BuyNowLink},inventory:{stockCountLabel:g.InventoryCountLabel,checkStockCountLabel:g.CheckAvailabilityLabel,checkOtherStockCountlabel:g.CheckOtherStoresLabel},product:{id:a.Upc,image:{alt:a.Title+".",url:a.Images&&a.Images.length>0?a.Images[0].LowRes:""},link:{url:a.BuyNowLink?a.BuyNowLink:"",target:"_blank",isAbsolute:!0},tags:a.Tags,title:a.Title,offer:a.OfferShortText,pwr:{id:"pw-snippet-"+a.UpcDisplay,apiKey:g.PwrApiKey,merchantId:g.PwrMerchantId,merchantGroupId:g.PwrMerchantGroupId,locale:g.PwrLocale},upc:a.UpcDisplay}}}},this)},onResize:function(){this.screenWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),this.screenWidth>640&&(this.isFiltersActive=!1,this.isFiltersMobile=!1,TweenLite.to(".module-product-listing-with-feature-filter__features-fieldset-container",.4,{height:0}),this.isFeatureFilterActive=!1)},showHideFeatureFilter:function(){this.isFeatureFilterActive?(TweenLite.to(".module-product-listing-with-feature-filter__features-fieldset-container",.4,{height:0}),this.isFeatureFilterActive=!1):(TweenLite.set(".module-product-listing-with-feature-filter__features-fieldset-container",{height:"auto"}),TweenLite.from(".module-product-listing-with-feature-filter__features-fieldset-container",.4,{height:0}),this.isFeatureFilterActive=!0)},showHideFilter:function(){this.isFiltersActive?(TweenLite.to(".module-product-listing-with-feature-filter__filters-container",.3,{height:0}),this.isFiltersActive=!1):(TweenLite.set(".module-product-listing-with-feature-filter__filters-container",{height:"auto"}),TweenLite.from(".module-product-listing-with-feature-filter__filters-container",.3,{height:0}),this.isFiltersActive=!0)},loadMoreProducts:function(){h.scrollTo$ElementAsync($(this.$refs.loadMoreButton),500),this.currentPageNumber=this.currentPageNumber+1,this.getProducts()},initFilters:function(a){a&&(a.categoryFilters&&(this.filteredProductsCategories=a.categoryFilters.map(function(a){return{Count:a.Count,Title:a.Name,TitleSlug:a.Key}})),a.brandFilters&&(this.filteredProductsBrands=a.brandFilters.map(function(a){return{Count:a.Count,Title:a.Name,TitleSlug:a.Key}})),a.featureFilters&&(this.filteredProductsFeatures=a.featureFilters.map(function(a){return{Count:a.Count,IconUrl:a.IconUrl,Title:a.Name,TitleSlug:a.Key}})))},updateUrlParam:function(){var a={};this.selectedCategories.length>0&&(a=Object.assign({},a,{categories:this.selectedCategories.join(",")})),this.selectedBrands.length>0&&(a=Object.assign({},a,{brands:this.selectedBrands.join(",")})),this.selectedFeatures.length>0&&(a=Object.assign({},a,{features:this.selectedFeatures.join(",")})),this.currentPageNumber=0,h.setUrlVars(a),this.getUrlVars(),this.getProducts()},hideFilters:function(){this.isFiltersActive=!1},clearFilters:function(){this.selectedBrands=[],this.selectedCategories=[],this.selectedFeatures=[],this.updateUrlParam()}}),computed:Object.assign({},Vuex.mapState("storeSelector",["inventories","popUp","selectedStore"]),{inventory:function(){return{stockCountLabel:g.InventoryCountLabel,checkStockCountLabel:g.CheckAvailabilityLabel,checkOtherStockCountlabel:g.CheckOtherStoresLabel}},totalPageNumber:function(){return Math.ceil(this.totalProductCount/g.ProductsPerPage)-1}})})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Data.ArticleAndVideoBadgeGrid"),f=b.resolve("SDM.Util");c.ArticleAndVideoBadgeGrid=function(a){new Vue({el:a[0],components:{"pop-up":d.PopUp},props:{},data:function(){return{articlesData:[],articlesGrid:[],componentKey:0,currentPage:0,selectedFilters:[],totalPages:0,videoId:"",videoTitle:""}},created:function(){this.articlesData=JSON.parse(e.TilesData),this.initArticlesGrid()},mounted:function(){this.showVideoModal(),this.$root.$on("pop-up-closed",function(){f.setUrlVars()}),this.initAnim()},methods:{initAnim:function(){TweenMax.set(".module-article-and-video-badge-grid__article",{opacity:0}),setTimeout(function(){TweenMax.staggerTo(".module-article-and-video-badge-grid__article",.4,{opacity:1},.1)},200)},initArticlesGrid:function(){var a;a=this.selectedFilters.length>0?this.articlesData.filter(function(a){return this.selectedFilters.findIndex(function(b){return a.Type===b})>=0}.bind(this)):this.articlesData,this.totalPages=(a.length-e.InitialLoadTileCount)/e.LoadMoreTileCount;var b;b=0===this.currentPage?a.slice(0,e.InitialLoadTileCount):a.slice(0,Number(e.InitialLoadTileCount)+Number(this.currentPage*e.LoadMoreTileCount)),this.articlesGrid=b.map(function(a){return{type:a.Type,description:a.Description,image:{altText:a.Image.Label,url:a.Image.URL},legalText:a.LegalText,tag:a.Tag,title:a.Title,timeToRead:a.TimeToRead,cta:{label:a.URLLabel,slug:a.FriendlyUrlName,target:a.Target,url:a.URL}}},this)},setVideoParam:function(a){f.setUrlVars({v:a}),this.showVideoModal()},showVideoModal:function(){if(f.getUrlVars().v){var a=this.articlesData.filter(function(a){if(a.FriendlyUrlName===f.getUrlVars().v)return a}.bind(this));this.videoTitle=a[0].Title,this.videoId=a[0].URL,this.$refs.articleVideoModal.showPopUp()}},onFiltersChange:function(){this.currentPage=0,this.initArticlesGrid(),this.initAnim()},onLoadMore:function(){f.scrollTo$ElementAsync($(this.$refs.loadMoreButton),500,100),this.currentPage++,this.initArticlesGrid()}}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Util");c.RichTextAreaGeo=function(a){var c=b.resolve("SDM.Vue.Vuex");c.hasModule("provinceSelector")||c.registerModule("provinceSelector",d.ProvinceSelector),new Vue({el:a[0],created:function(){},computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{}),data:function(){return{sdmLocationProvinceId:""}},methods:{},mounted:function(){var a=JSON.parse(e.getValueFromCookie("sdm-location"));this.sdmLocationProvinceId=a&&a.province?a.province:""},store:c,watch:{}})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Widgets"),f=0;c.VideoProductCarousel=function(a){var c=a.data("contentId"),g=b.resolve("SDM.Data.VideoProductCarousel")[c],h=b.resolve("SDM.Vue.Vuex");h.hasModule("storeSelector")||h.registerModule("storeSelector",d.StoreSelector),new Vue({el:a[0],store:h,components:{"product-carousel":e.ProductCarousel,"store-selector-modal":e.StoreSelectorModal},data:function(){return{modifiedProducts:[],products:[],reviewArray:[],showInventory:!1,categoryCarouselsSlidesToShow:{desktop:3,tablet:1,mobile:1},breakpoints:{tablet:960}}},beforeMount:function(){this.products=g.Products,this.showInventory="False"===g.HideInventory,this.initModifiedProducts()},mounted:function(){this.setInventories(g.Inventory.Stores);var a=this;setTimeout(function(){a.initPowerReviewsRatings(a.modifiedProducts)},f),f+=500},methods:Object.assign({},Vuex.mapActions("storeSelector",{setInventories:"setInventories"}),{initModifiedProducts:function(){this.modifiedProducts=this.products.map(function(a){var b={};return this.showInventory&&(b={stockCountLabel:g.InStoreLabel,checkStockCountLabel:g.CheckAvailabilityLabel,checkOtherStockCountlabel:g.CheckOtherStoresLabel}),{id:a.UpcStripped,text1:a.Title.split(" ").length>8?a.Title.split(" ").slice(0,6).join(" ")+"...":a.Title,image:{url:a.ImageUrl,alt:a.Title+" image"},link:a.ProductCTA,cta:{url:a.ProductCTA,label:g.ShopLabel,isAbsolute:!!a.ProductCTA},pwr:{id:a.UpcStripped?c+"-video-product-carousel-pwr-snippet--"+a.UpcStripped:null},upc:a.UpcStripped,inventory:b}},this)},initPowerReviewsRatings:function(a){for(var b=[],c=0;a.length>c;c++)null!==a[c].pwr&&b.push({api_key:g.PowerReviewsApiKey,locale:g.PowerReviewsLocale,merchant_group_id:g.PowerReviewsMerchantGroupId,merchant_id:g.PowerReviewsMerchantId,page_id:a[c].upc,components:{CategorySnippet:a[c].pwr.id}});pwr("render",b)}})})}}(this),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Vue.Modules"),d=b.resolve("SDM.Vue.Stores"),e=b.resolve("SDM.Vue.Widgets");c.ProvinceSelector=function(a){var c=b.resolve("SDM.Vue.Vuex");c.hasModule("provinceSelector")||c.registerModule("provinceSelector",d.ProvinceSelector),new Vue({components:{"province-selector":e.ProvinceSelector},computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{}),data:function(){return{}},el:a[0],methods:{},mounted:function(){},store:c})}}(this),function(a){"use strict";var b=a.jQuery,c=a.NR,d=c.resolve("SDM.Vue.Modules"),e=c.resolve("SDM.Vue.Stores"),f=c.resolve("SDM.Vue.Mixins"),g=c.resolve("SDM.Util");d.TextBadgeGrid=function(a){var d=a.data("contentId"),h=c.resolve("SDM.Data.TextBadgeGrid")[d],i=c.resolve("SDM.Vue.Vuex");i.hasModule("provinceSelector")||i.registerModule("provinceSelector",e.ProvinceSelector),new Vue({computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{badges:function(){return h.Badges.filter(function(a){return a.provinces.includes(this.userProvinceId)}.bind(this))},numColumns:function(){return this.isDesktopLarge?4:this.isDesktop?2:1}}),data:function(){return{buttonFilters:h.ButtonFilters,cta1Height:[],selectedFilter:"",headingHeight:[],noteHeight:[],textHeight:[],text2Height:[]}},el:a[0],methods:{getHeadingHeight:function(a){var b=this.headingHeight[Math.floor(a/this.numColumns)];return b||0},getTextHeight:function(a){var b=this.textHeight[Math.floor(a/this.numColumns)];return b||0},getText2Height:function(a){var b=this.text2Height[Math.floor(a/this.numColumns)];return b||0},getNoteHeight:function(a){var b=this.noteHeight[Math.floor(a/this.numColumns)];return b||0},getCta1Height:function(a){var b=this.cta1Height[Math.floor(a/this.numColumns)];return b||0},getMaxHeadingHeight:function(){var a=Array.from(this.$el.querySelectorAll(".module-text-badge-grid__badge__heading")||[]);this.headingHeight=[];for(var b=0,c=a.length;b .wg-acc-content").slideToggle()},methods:{getYouTubeID:function(a){var b=/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/,c=a.match(b);return!(!c||11!==c[7].length)&&c[7]},getVimeoID:function(a){var b=/\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,c=a.match(b);return!(!c||!c[2])&&c[2]},toggleAccordion:function(a){c(a.target).parent().toggleClass("wg-acc-active"),c(a.target).next().slideToggle()},toggleAccordionIcon:function(a){c(a.target).parent().parent().toggleClass("wg-acc-active"),c(a.target).parent().next().slideToggle()}},store:d})}}(this),function(a){"use strict";a.NR.resolve("SDM.Vue.Modules").GlobalPromotionGrid=function(a){new Vue({data:function(){return{seenBadges:[]}},el:a[0],methods:{badgeClick:function(a){window.location.href.includes("home")&&dataLayer.push({event:"badge_click","badge.id":a.currentTarget.getAttribute("data-id"),"badge.position":a.currentTarget.getAttribute("data-index"),"badge.name":a.currentTarget.getAttribute("data-name"),"badge.image_url":a.currentTarget.querySelectorAll(".md-gpg__badge-image")[0].src})},isElementInView:function(a){var b=a.getBoundingClientRect(),c=b.top,d=b.top+b.height;return c>=0&&d<=Math.min(document.documentElement.clientHeight,window.innerHeight||0)},checkElementViewability:function(){for(var a=document.querySelectorAll(".md-gpg__badge"),b=0;b <%= condition.name %> <% }); %>",alphabetLink:"<%= alphabet %>"},defaultListItemLimit:0,urls:{conditionListJson:"/<%- shortLanguageCode %>/condition/getConditionsByLetter?letter=<%- alphabet %>",conditionDetailPage:"/<%- shortLanguageCode %>/health-and-pharmacy/conditions/<%= name %>/<%- id %>",conditionPage:"/<%- shortLanguageCode %>/health-and-pharmacy/conditions/<%- alphabet %>"}};this.config=d.extend(!0,c,b||{}),this._initialize(a)};a.prototype.getConditionObject=function(a,b,e){var f=this._getJsonUrl(b),g=this,h=function(b){return b=c(b).filter(function(a){return a.DiseaseName&&a.DiseaseId}),a>0&&(b=b.slice(0,a)),c(b).map(function(a){return{name:a.DiseaseName,link:g._getConditionDetailPageLink(a.SafeDiseaseName,a.DiseaseId)}})};return d.ajax({dataType:"json",url:f,beforeSend:e}).pipe(h)},a.prototype._getJsonUrl=function(a){return this.urls.conditionListJson({alphabet:encodeURIComponent(a),shortLanguageCode:f.getShortLanguageCode()})},a.prototype._getConditionDetailPageLink=function(a,b){return this.urls.conditionDetailPage({name:encodeURIComponent(a).toLowerCase(),id:encodeURIComponent(b),shortLanguageCode:f.getShortLanguageCode()})},a.prototype.getConditionPageLink=function(a){return this.urls.conditionPage({alphabet:encodeURIComponent(a).toLowerCase(),shortLanguageCode:f.getShortLanguageCode()})},h.prototype._initialize=function(b){var d=this.config.dataLabels,e=this.config.templates,f=b,g=f.find("["+d.listTemplate+"]"),h=g.length>0?g.html():e.list,i=f.find("["+d.alphabetLinkTemplate+"]"),j=i.length>0?i.html():e.alphabetLink,k=c.bind(this._onClickAlphabetButton,this);this.listTemplate=c.template(h),this.$listContainer=f.find("["+d.listContainer+"]"),this.alphabetLinkTemplate=c.template(j),this.$alphabetLinkContainer=f.find("["+d.alphabetLinkContainer+"]"),this.listItemLimit=f.attr(d.listItemLimit)||this.config.defaultListItemLimit,this.$loadingContainer=f.find("["+d.loadingContainer+"]"),this.$errorContainer=f.find("["+d.errorContainer+"]"),this.activeAlphabetContainer=f.find("["+d.activeAlphabetContainer+"]"),this.alphabetButtonAttributeName=d.alphabetButton,this.$alphabetButtons=f.find("["+d.alphabetButton+"]"),this.defaultAlphabet=f.attr(d.defaultAlphabet)||null,this.$noItemsContainer=f.find("["+d.noItemsContainer+"]"),this.onChangeEventHandler=function(){}, this.previousAjaxRequestXhr=null,this.previousAlphabet=null,this.gateway=new a(this.config),this._deleteListItems(),this._deleteAlphabetLink(),this._hideLoading(),this._hideError(),this.$alphabetButtons.on("click.sdm-condition-widget",k),this.defaultAlphabet&&this.render(this.defaultAlphabet)},h.prototype._onClickAlphabetButton=function(a){var b=d(a.currentTarget),c=b.attr(this.alphabetButtonAttributeName);this.render(c)},h.prototype._activateButton=function(a){this.$alphabetButtons.removeClass(this.config.class_names.active),a.addClass(this.config.class_names.active)},h.prototype._renderAlphabetCharacter=function(a){this.activeAlphabetContainer.text(a)},h.prototype._renderAlphabetLink=function(a){this.$alphabetLinkContainer.html(this.alphabetLinkTemplate(a))},h.prototype._deleteAlphabetLink=function(){this.$alphabetLinkContainer.empty()},h.prototype._renderListItems=function(a){this.$listContainer.html(this.listTemplate({conditions:a}))},h.prototype._deleteListItems=function(){this.$listContainer.empty()},h.prototype._showLoading=function(){this.$loadingContainer.show()},h.prototype._hideLoading=function(){this.$loadingContainer.hide()},h.prototype._showError=function(){this.$errorContainer.show()},h.prototype._hideError=function(){this.$errorContainer.hide()},h.prototype._showNoItems=function(){this.$noItemsContainer.show()},h.prototype._hideNoItems=function(){this.$noItemsContainer.hide()},h.prototype.render=function(a){var b=this.$alphabetButtons.filter("["+this.alphabetButtonAttributeName+"='"+a+"']"),d=this.previousAlphabet&&this.previousAlphabet!==a,e=null===this.previousAlphabet,f=c.bind(function(a){a.length>0?this._renderListItems(a):this._showNoItems(),this._hideLoading()},this),g=c.bind(function(){this._showError(),this._hideLoading(),this.previousAlphabet=null},this),h={alphabet:a,link:this.gateway.getConditionPageLink(a)},i=c.bind(function(a){this.previousAjaxRequestXhr=a},this);(e||d)&&(d&&this.onChangeEventHandler(a),this.previousAjaxRequestXhr&&this.previousAjaxRequestXhr.abort(),this._activateButton(b),this._showLoading(),this._deleteListItems(),this._hideError(),this._hideNoItems(),this._renderAlphabetCharacter(a),this._renderAlphabetLink(h),this.previousAlphabet=a,this.gateway.getConditionObject(this.listItemLimit,a,i).done(f).fail(g))},h.prototype.setOnChangeEventHandler=function(a){this.onChangeEventHandler=a}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d="<%= title %> <%= views %> views <%= age %> ago",e=a.NR||(a.NR={}),f=e.resolve("SDM.Core.Widgets"),g=e.resolve("SDM.Util"),h=f.FeaturedVideo=function(a,b){var d={data_labels:{video_placeholder:"data-fvd-video-placeholder",video_info_template:"data-fvd-video-info-template",video_info_container:"data-fvd-video-info-container",loading_container:"data-fvd-loading-container",error_container:"data-fvd-error-container",youtube_api_key:"AIzaSyAqyipvzq62aB7-5OZ35FiVAp4T2WszDTM",youtube_video:"data-fvd-youtube-id",vimeo_video:"data-fvd-vimeo-id"},video_info_template:""};this.config=c.extend(!0,d,b||{}),this._initialize(a)},i=h.YoutubeVideo=function(a,b,d){var e={url_regex:/youtube\.com\/watch\?(.*)([^&]&)?v=([^\s]+)/};this.config=c.extend(!0,e,d||{}),this._setInstanceVars(b,a),this._initialize()};i.prototype._setInstanceVars=function(a,b){var c=a.match(this.config.url_regex);this.video_id=c&&c[3]?c[3]:null;var d=this.config.data_labels;this.$container=b,this.$video_placeholder=b.find("["+d.video_placeholder+"]"),this.$video_info_container=b.find("["+d.video_info_container+"]"),this.$loading_container=b.find("["+d.loading_container+"]"),this.$error_container=b.find("["+d.error_container+"]"),this.video_info_template=this.config.video_info_template},i.prototype._initialize=function(){if(this.$loading_container.hide(),this.$error_container.hide(),this.$video_info_container.hide(),!this.video_id)return this.$loading_container.hide(),this.$error_container.show(),void this.$video_info_container.hide();this._loadVideo(),this._loadData()},i.prototype._loadVideo=function(){g.loadYoutubeVideoApi().done(b(this._createPlayerInstance).bind(this))},i.prototype._createPlayerInstance=function(){var a=this.$video_placeholder.attr("id",this.video_id).attr("id"),b=this.$video_placeholder.attr("width"),c=this.$video_placeholder.attr("height");return new YT.Player(a,{width:b,height:c,videoId:this.video_id,playerVars:{controls:1,showinfo:0,modestbranding:1,wmode:"opaque"}})},i.prototype._loadData=function(){var a=this.config.youtube_api_key,c="https://www.googleapis.com/youtube/v3/videos?id="+this.video_id+"&key="+a+"&part=snippet,statistics";this.$loading_container.show(),this.$error_container.hide(),this.$video_info_container.hide();var d=b(this._renderVideoInfo).bind(this),e={dataType:"json"};SDM.Util.ajax(c,e).done(d).fail(b(function(){this.$error_container.show(),this.$loading_container.hide()}).bind(this))},i.prototype._renderVideoInfo=function(a){var b=this._parseVideoInfo(a);this.$video_info_container.html(this.video_info_template(b)).show(),this.$loading_container.hide()},i.prototype._parseVideoInfo=function(a){if(!(a&&a.items&&a.items.length))return{};var b=a.items[0];return{title:b.snippet.title,link:"https://www.youtube.com/watch?v="+b.id,views:parseInt(b.statistics.viewCount,10).toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),age:this._getAge(b.snippet.publishedAt)}},i.prototype._getAge=function(a){var b=new Date,c=new Date(Date.parse(a)),d={};return d.diffYears=b.getUTCFullYear()-c.getUTCFullYear(),d.diffMonths=b.getUTCMonth()-c.getUTCMonth()+12*d.diffYears,d};var j=h.VimeoVideo=function(a,b,d){var e={};this.config=c.extend(!0,e,d||{}),this._setInstanceVars(b,a),this._initialize()};j.prototype._setInstanceVars=function(a,b){this.video_id=a;var c=this.config.data_labels;this.$video_info_container=b.find("["+c.video_info_container+"]"),this.$loading_container=b.find("["+c.loading_container+"]"),this.$error_container=b.find("["+c.error_container+"]"),this.video_info_template=this.config.video_info_template},j.prototype._initialize=function(){if(this.$loading_container.hide(),this.$error_container.hide(),this.$video_info_container.hide(),!this.video_id)return this.$loading_container.hide(),this.$error_container.show(),void this.$video_info_container.hide();this._loadData()},j.prototype._loadData=function(){this.$loading_container.show(),this.$error_container.hide(),this.$video_info_container.hide();var a="https://vimeo.com/api/v2/video/"+this.video_id+".json",c=b(this._renderVideoInfo).bind(this),d={data:{},dataType:"json"};SDM.Util.ajax(a,d).done(c).fail(b(function(){this.$error_container.show(),this.$loading_container.hide()}).bind(this))},j.prototype._renderVideoInfo=function(a){if(a.length>0){var b=this._parseVideoInfo(a[0]);this.$video_info_container.html(this.video_info_template(b)).show(),this.$loading_container.hide()}},j.prototype._parseVideoInfo=function(a){return{title:a.title,link:a.url,views:a.stats_number_of_plays,age:this._getAge(a.upload_date)}},j.prototype._getAge=function(a){var b=new Date,c=new Date(Date.parse(a)),d={};return d.diffYears=b.getUTCFullYear()-c.getUTCFullYear(),d.diffMonths=b.getUTCMonth()-c.getUTCMonth()+12*d.diffYears,d},h.prototype._initialize=function(a){this.config.video_info_template=this._getVideoInfoTemplate();var b=a,c=b.attr(this.config.data_labels.youtube_video),d=b.attr(this.config.data_labels.vimeo_video);c?new i(b,c,this.config):d&&new j(b,d,this.config)},h.prototype._getVideoInfoTemplate=function(){var a=c("["+this.config.data_labels.video_info_template+"]"),e=a.length>0?a.html():d;return b(e).template()}}.call(this),function(){function a(a,b){this._config=b,this._$widget=a,this._initialize()}function b(a,b,c){this._config=c,this._$star=a,this._index=b}var c=this,d=c._,e=c.jQuery,f="sdm-product-rating",g=c.NR||(c.NR={}),h=g.resolve("SDM.Core.Widgets");b.prototype.empty=function(){this._$star.addClass(this._config.classNames.emptyStar).removeClass(this._config.classNames.filledStar)},b.prototype.fill=function(){this._$star.removeClass(this._config.classNames.emptyStar).addClass(this._config.classNames.filledStar)},b.prototype.getIndex=function(){return this._index},b.prototype.setOnMouseEnterEventHandler=function(a){this._$star.on("mouseenter."+f,d(function(){a(this)}).bind(this))},b.prototype.setOnMouseLeaveEventHandler=function(a){this._$star.on("mouseleave."+f,d(function(){a(this)}).bind(this))},b.prototype.setOnClickEventHandler=function(a){this._$star.on("click."+f,d(function(){a(this)}).bind(this))},a.prototype._initialize=function(){this._stars=d(this._$widget.find("["+this._config.dataLabels.star+"]")).map(d(function(a,c){var f=new b(e(a),c,this._config);return f.setOnMouseEnterEventHandler(d(this._onMouseEnterStarEventHandler).bind(this)),f.setOnMouseLeaveEventHandler(d(this._onMouseLeaveStarEventHandler).bind(this)),f.setOnClickEventHandler(d(this._onClickStarEventHandler).bind(this)),f}).bind(this)),this._rate=parseInt(this._$widget.attr(this._config.dataLabels.rate)||0,10),this.updateStar()},a.prototype._onMouseEnterStarEventHandler=function(a){this._renderStar(a.getIndex())},a.prototype._onMouseLeaveStarEventHandler=function(){this.updateStar()},a.prototype._onClickStarEventHandler=function(a){this.setRate(a.getIndex()+1)},a.prototype._renderStar=function(a){d(this._stars).each(function(b){b.getIndex()<=a?b.fill():b.empty()})},a.prototype.updateStar=function(){this._renderStar(this._rate-1)},a.prototype.setRate=function(a){this._rate=a,this.updateStar()},a.prototype.getRate=function(){return this._rate},h.ProductRating=function(b,c){var d={dataLabels:{star:"data-prt-star",rate:"data-prt-rate"},classNames:{emptyStar:"mod-icn-gray-star",filledStar:"mod-icn-red-star"}};return new a(b,e.extend(!0,d,c||{}))}}.call(this),function(){var a=this,b=this._,c=a.jQuery,d=a.Accordion,e=a.NR,f=e.resolve("SDM.Core.Components"),g=e.resolve("SDM.Core.Widgets"),h=f.PopUp;FAQModal=g.FAQModal=function(a,b){var d={selectors:{fap_popup:"[data-wg-faq-popup]",faq_content:"[data-wg-faq-content]",faq_nano:"[data-wg-faq-nano]",faq_nano_content:"[data-wg-faq-nano-content]",parent_accordion:"[data-wg-faq-parent-accordion]",parent_accordion_button:"[data-wg-faq-parent-accordion-button]",parent_accordion_content:"[data-wg-faq-parent-accordion-content]",accordion:"[data-wg-faq-accordion]",accordion_button:"[data-wg-faq-accordion-button]",accordion_content:"[data-wg-faq-accordion-content]",flag:"[data-wg-faq-flag]",faq_list:"[data-wg-faq-list]",question_list:"[data-wg-faql-question-list]",question_list_item:"[data-wg-faql-question-list-item]"},classnames:{accordion_active_class:"wg-acc-active",parent_accordion_actice_class:"wg-parent-acc--active"},attributes:{list_item_id:"data-wg-faql-question-list-item",flag:"data-wg-faq-flag"},data_attributes:{initial_active_id:"wg-faq-initial-active-id",list_item_id:"wg-faql__question-list-item"}};this.config=c.extend(!0,d,b||{}),this._initialize(a)},FAQModal.prototype._initialize=function(a){this.$link=a,this.$link.on("click",b.bind(function(a){this.linkToFlag=c(a.currentTarget).attr(this.config.attributes.flag),a.preventDefault(),this._openPopup()},this)),this.popup=new h({templates:{modal:''}}),this.template=b.template(c(this.config.selectors.faq_content).html()),this.initial_active_id=this.$link.data(this.config.data_attributes.initial_active_id)||null,this.$faqPopup=null,this.$nano=null,this.$nanoContent=null,this.nanoContentClass=null,this.linkToFlag=null,this.isClosed=!0,SDM.Util.isWindowWide()?this.popupHeightOffset=40:this.popupHeightOffset=0,this.popup.onOpenCompleted(b(this._onPopupOpened).bind(this)),this.popup.onCloseCompleted(b(this._onPopupClosed).bind(this)),this.popup.onRepositioned(b(this._onPopupRepositioned).bind(this))},FAQModal.prototype._initializeNanoScroller=function(a){var c={contentClass:this.nanoContentClass,preventPageScrolling:!0,alwaysVisible:!0};b(a).isNumber()&&(c.scrollTop=a),this.$nano.nanoScroller(c)},FAQModal.prototype._onPopupOpened=function(a){var e;if(new Analytics.DataAttributes,this.isClosed){this.$faqPopup.outerWidth(this.popup.$modal.css("width")),this.$nanoContent.css("position","");var f=null,g=0;b(c(a.currentTarget).find(this.config.selectors.parent_accordion)).each(b(function(a){var e=new d(c(a),{selectors:{button:this.config.selectors.parent_accordion_button,content:this.config.selectors.parent_accordion_content},classnames:{active:this.config.classnames.parent_accordion_actice_class}});e.id=g++,e.isActive()&&(e.open(0),f=e),e.onClickButton(b(function(){f&&f.id!==e.id&&f.close()}).bind(this)),e.onOpenCompleted(b(function(){f=e,this._initializeNanoScroller(),c(this.$nano.find(this.config.selectors.faq_nano_content)).stop().animate({scrollTop:f.$element.get(0).offsetTop-15},300)}).bind(this)),e.onCloseCompleted(b(function(){this._initializeNanoScroller(),f&&f.id===e.id&&(f=null)}).bind(this))}).bind(this)),b(c(a.currentTarget).find(this.config.selectors.accordion)).each(b(function(a){var e=c(a),f=new d(e,{selectors:{button:this.config.selectors.accordion_button,content:this.config.selectors.accordion_content}});f.isActive()&&(f.open(0),c(this.$nano.find(this.config.selectors.faq_nano_content)).stop().animate({scrollTop:e.get(0).offsetTop-15},300)),f.onOpenCompleted(b(function(){this._initializeNanoScroller()}).bind(this)),f.onCloseCompleted(b(function(){this._initializeNanoScroller()}).bind(this))}).bind(this)),this.linkToFlag?(e=this._findFlag(this.linkToFlag),0!==e.length?this._initializeNanoScroller(e.position().top):this._initializeNanoScroller()):this._initializeNanoScroller(),this.isClosed=!1}},FAQModal.prototype._findFlag=function(a){return this.$nanoContent.find(this.config.selectors.flag).filter("["+this.config.attributes.flag+"='"+a+"']")},FAQModal.prototype._onPopupClosed=function(){this.isClosed=!0},FAQModal.prototype._onPopupRepositioned=function(){this.popup.$modal&&(this.$faqPopup.outerWidth(this.popup.$modal.width()),this._initializeNanoScroller())},FAQModal.prototype._openPopup=function(){var a,b=this.template(),d=c(b);this.$faqPopup=d.is(this.config.selectors.fap_popup)?d:d.find(this.config.selectors.fap_popup),this.$nano=d.find(this.config.selectors.faq_nano),this.$nanoContent=d.find(this.config.selectors.faq_nano_content),this.nanoContentClass=this.$nanoContent.attr("class"),a=this.linkToFlag?this._findFlag(this.linkToFlag):c({}),this.initial_active_id?d.find("["+this.config.attributes.list_item_id+'="'+this.initial_active_id+'"]:first').find(this.config.selectors.accordion).addClass(this.config.classnames.accordion_active_class).parents(this.config.selectors.parent_accordion).addClass(this.config.classnames.parent_accordion_actice_class):a.length?a.addClass(this.config.classnames.parent_accordion_actice_class):d.find(this.config.selectors.question_list_item+":first").parents(this.config.selectors.parent_accordion).addClass(this.config.classnames.parent_accordion_actice_class),this.$nanoContent.css("position","static"),this.$faqPopup.css("height",c(window).height()-this.popupHeightOffset),this.popup.open(d[0])},FAQModal.prototype.get$link=function(){return this.$link}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e="gpalwf-events",f=a.NR||(a.NR={}),g=f.resolve("SDM.Core.Components"),h=f.resolve("SDM.Core.Widgets"),i=g.CollapsibleButtonList,j=g.ArticleSummaryCollection,k=g.ArticleSummaryListingView,l=null,m=h.GeneralArticleSummaryListing=function(a,b){var d={selectors:{listingContainer:"[data-wg-gasl-listing-container]",filterContainer:"[data-wg-gasl-filter-container]",pageTitle:"[data-wg-gasl-title]",filterButton:"[data-wg-gasl-filter-button]",defaultButton:"[data-wg-gasl-filter-button-default]"},attributes:{tag:"data-wg-gasl-article-tag",detailPageUrlRoot:"data-wg-gasl-detail-page-url-root",jsonResourceUrlRoot:"data-wg-gasl-json-resource-url-root",filterRouterUrlRoot:"data-wg-gasl-filter-router-url-root",filterId:"data-wg-gasl-filter-id",filterPageTitle:"data-wg-gasl-filter-title",filterName:"data-wg-gasl-filter-name",truncateLimit:"data-wg-gasl-truncate-limit",destinationID:"data-wg-gasl-destinationID",tagID:"data-wg-gasl-tagID",articleIDs:"data-wg-gasl-articleIDs"}};this.config=c.extend(!0,d,b||{}),this._initialize(a)};m.prototype._initialize=function(a){this.tag=a.attr(this.config.attributes.tag)||"",this.destinationID=a.attr(this.config.attributes.destinationID)||"",this.tagID=a.attr(this.config.attributes.tagID)||"",this.articleIDs=a.attr(this.config.attributes.articleIDs)||"",this.truncateLimit=a.attr(this.config.attributes.truncateLimit)||"0",this.detailPageUrlRoot=a.attr(this.config.attributes.detailPageUrlRoot),this.jsonResourceUrlRoot=a.attr(this.config.attributes.jsonResourceUrlRoot),this.filterRouterUrlRoot=this._cleanUpUrL(a.attr(this.config.attributes.filterRouterUrlRoot)||""),this.$listingContainer=a.find(this.config.selectors.listingContainer),this.$filterContainer=a.find(this.config.selectors.filterContainer),this.$pageTitle=a.find(this.config.selectors.pageTitle),this.router=null,this._setupListing(),this.$filterContainer.length>0&&this.filterRouterUrlRoot?(this.$filterButtons=a.find(this.config.selectors.filterButton),this.collapsibleButtonList=new i({$container:this.$filterContainer}),this.$filterButtons.on("click."+e,b(this._onClickFilterLink).bind(this)),this.router=new l({urlRoot:this.filterRouterUrlRoot}),this.router.on("route-home",b(function(){this.$filterButtons.filter(this.config.selectors.defaultButton).trigger("click."+e,{isPreventNavigation:!0})}).bind(this)),this.router.on("route-filter",b(function(a,b){this.$filterButtons.filter("["+this.config.attributes.filterId+"='"+b+"']").trigger("click."+e,{isPreventNavigation:!0})}).bind(this)),this.router.start()):this.articleSummaryCollection.setCurrentPage(1).setCategoryId().fetch()},m.prototype._setupListing=function(){this.articleSummaryCollection=new j,this.articleSummaryListingView=new k({$container:this.$listingContainer,collection:this.articleSummaryCollection}),this.articleSummaryCollection.setTag(this.tag).setDestinationID(this.destinationID).setTagID(this.tagID).setArticleIDs(this.articleIDs).setDetailPageUrlRoot(this.detailPageUrlRoot).setTruncateLimit(this.truncateLimit).setJsonResourceUrlRoot(this.jsonResourceUrlRoot)},m.prototype._onClickFilterLink=function(a,d){d=d||{};var e=c(a.currentTarget),f=e.attr(this.config.attributes.filterId),g=e.attr(this.config.attributes.filterPageTitle),h=(e.attr(this.config.attributes.filterName)||"").toLowerCase(),i=e.is(this.config.selectors.defaultButton);if(this.articleSummaryListingView.showLoading(),this.articleSummaryListingView.clearResults(),this.articleSummaryCollection.setCurrentPage(1).setCategoryId(f).fetch(),b.each(this.collapsibleButtonList.getItems(),function(a){a.getName()===f?a.addActiveClass():a.removeActiveClass()}),this.$pageTitle.length>0&&this.$pageTitle.html(g),a.preventDefault(),d.isPreventNavigation)return void this.articleSummaryListingView.clearResults();i?this.router.navigate(""):this.router.navigate(h+"/"+f)},m.prototype._cleanUpUrL=function(a){if(""===a)return"";var b=a.match(/^(http[s]?:\/\/[^\/]+)?(\/.*)$/);return b&&b.length>=3&&b[2]?b[2]:null},l=d.Router.extend({initialize:function(a){this.urlRoot=a.urlRoot,this.route("","home"),this.route(/^([A-Za-z0-9_\-]+)\/(\d+)$/,"filter")},home:function(){this.trigger("route-home")},filter:function(a,b){this.trigger("route-filter",a,b)},start:function(){d.history.start({pushState:!0,root:this.urlRoot})}})}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e=d.SharedSimpleRouter.getInstance(),f=a.NR||(a.NR={}),g=f.resolve("SDM.Core.Widgets"),h=g.AnchorsInPage=function(a,b){var d={selectors:{container:"[data-widget-anchors-in-page]",anchor:"[data-wg-aip-anchor]"},attributes:{active_class_name:"data-wg-aip-active-class",default_route_id:"data-wg-aip-default-route-id"}};this.config=c.extend(!0,d,b||{}),this._initialize(a)};h.prototype._initialize=function(a){a=a.is(this.config.selectors.container)?a:a.find(this.config.selectors.container),0!==a.length&&(this.defaultRouteId=a.attr(this.config.attributes.default_route_id)||!1,this.activeClassName=a.attr(this.config.attributes.active_class_name),this.anchors=b(b(a.find(this.config.selectors.anchor)).map(b(function(a){var b=c(a);return[b.attr("href").replace("#",""),b]}).bind(this))).object(),this._setupRouter(),this._setupClickEvent())},h.prototype._setupRouter=function(){b(this.anchors).each(b(function(a,c){e.on(c,b(function(){this._addActiveClass(c)}).bind(this))}).bind(this)),!this.anchors[""]&&this.defaultRouteId&&e.on("",b(function(){this._addActiveClass(this.defaultRouteId)}).bind(this)),e.historyStart()},h.prototype._setupClickEvent=function(){b(this.anchors).each(b(function(a,c){a.on("click.anchors-in-page",b(function(a){e.navigate(c,{trigger:!0}),a.preventDefault()}).bind(this))}).bind(this))},h.prototype._addActiveClass=function(a){b(this.anchors).each(b(function(b,c){a===c?b.addClass(this.activeClassName):b.removeClass(this.activeClassName)}).bind(this))}}.call(this),function(a){"use strict";var b=a.jQuery,c=a.NR||(a.NR={}),d=c.resolve("SDM.Core.Widgets"),e=c.resolve("SDM.Util"),f=c.resolve("SDM.Core.Components.BrooklynAuth"),g=f.Repository;d.BrooklynLogin=function(a,c){c=c||{},b(".widget-brooklyn-login--okta").length>=1&&g.getOktaConfigurationAsync().done(_.bind(function(a){for(var d={okta:{i18n:{en:{},fr:{}},baseUrl:a.EnvironmentBaseUrl,pcidUrls:{pcidMigrationUrl:a.PcidMigrationUrl,passwordPolicyUrl:a.PasswordPolicyUrl},language:e.getShortLanguageCode(),assets:{baseUrl:"https://assets.lblw.cloud/okta-signin-widget"},helpLinks:{forgotPassword:"https://www.pcoptimum.ca/forgot-password",login:[{text:"",link:"ld.pcid.primary.auth.create.account",href:"https://www.pcoptimum.ca/register"}],mfa:[{text:"ld.pcid.primary.auth.need.help",link:"ld.pcid.primary.auth.contact.support",href:"https://loblaw.force.com/PCoptimumsupport/s/?language="+e.getShortLanguageCode()}]}}},f=0;f0,this.has_mobile_images=b.length>0,this.image_loader_promise=c.when.apply(this,[d,e]).promise()},onOpenPopUp:function(a){this.on("open-popup",a)},onClickContent:function(a){this.on("click-content",a)},onClosePopup:function(a){this.on("close-popup",a)},isAbleToShowPopup:function(){return(SDM.Util.isWindowWide()||SDM.Util.isWindowSmallDesktopWide()||SDM.Util.isWindowExtraWide())&&this.has_pc_images||!SDM.Util.isWindowWide()&&this.has_mobile_images},showPopUp:function(){this.image_loader_promise.done(b(function(){if(this.isAbleToShowPopup()){this.popup=new f,this.popup.open(this.el),a.Placeholder&&new Placeholder,this.trigger("open-popup"),this.popup.$modal.find(this.config.selectors.content).on("click."+h+"-"+this.cid,b(function(){this.trigger("click-popup")}).bind(this)),this.popup.onCloseCompleted(b(function(){this._unbindResizeEvents(),this.trigger("close-popup")}).bind(this));var c=this.$('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])').first();c.length&&c.focus(),this.popup.$modal.on("keydown",function(a){var b="Tab"===a.key||9===a.keyCode,c=event.currentTarget;if(b){var d=c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),e=d[0],f=d[d.length-1];a.shiftKey?document.activeElement===e&&(f.focus(),a.preventDefault()):document.activeElement===f&&(e.focus(),a.preventDefault())}}),this._bindResizeEvents()}}).bind(this))},_createImageLoaderPromise:function(a){var d=b(a).map(function(a){var b=c.Deferred(),d=new Image;return c(d).on("load",function(){b.resolve()}),d.src=a.src,b.promise()});return c.when.apply(this,d).promise()},_switchModeToPC:function(){this.popup&&!this.has_pc_images&&this.popup.close()},_switchModeToMobile:function(){this.popup&&!this.has_mobile_images&&this.popup.close()},_bindResizeEvents:function(){this.$window.on("becometowide."+h+"-"+this.cid,b(this._switchModeToPC).bind(this)),this.$window.on("becometonarrow."+h+"-"+this.cid,b(this._switchModeToMobile).bind(this))},_unbindResizeEvents:function(){this.$window.off("becometowide."+h+"-"+this.cid),this.$window.off("becometonarrow."+h+"-"+this.cid)}})}.call(this),function(a){var b=a.jQuery,c=a.NR||(a.NR={}),d=c.resolve("SDM.Core.Components"),e=c.resolve("SDM.Core.Widgets"),f=d.PopUp,g=e.PopUpBlogRedirect=function(a,c){c=c||{};var d={selectors:{redirect_image:"[data-pbr-redirect-image]"}};this.config=b.extend(!0,{},d,c),this.$el=a,this._init()};g.prototype._init=function(){this.popup=new f,this.popup_content=this.$el.html(),this.event_namespace="."+_.uniqueId("PopUpBlogRedirect_"),this.popup.onOpenCompleted(_.bind(this._bindEvents,this))},g.prototype.openPopUp=function(){this.popup.open(this.popup_content)},g.prototype.isViewable=function(){return!0},g.prototype._bindEvents=function(){this.popup.$modal.on("click"+this.event_namespace,this.config.selectors.redirect_image,_.bind(function(){this.popup.close()},this))}}(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Widgets"),f=d.resolve("SDM.Core.Components.EventHub"),g=e.PopUpManager=function(a,b){b=b||{};var d={selectors:{widget:"[data-popup-widget]"},data_attributes:{name:"popup-widget",priority:"popwg-priority"},names:{brooklyn_convert_popup:"brooklyn-convert-popup",pop_up_optimum_vib:"pop-up-optimum-vib",pop_up_welcome:"pop-up-welcome",pop_up_blog_redirect:"pop-up-blog-redirect"}};this.config=c.extend(!0,{},d,b),this._initialize(a)};g.prototype._initialize=function(){var a=c(this.config.selectors.widget),d=this.config.names;this.popups=[],this.boundUnshift=b.bind(this.unshift,this),this.boundEmpty=b.bind(this.empty,this),b.each(a,function(a){var b=c(a),f=b.data(this.config.data_attributes.name),g=b.data(this.config.data_attributes.priority);switch(f){case d.brooklyn_convert_popup:this.popups.push({widget:new e.BrooklynConvertPopup(b),priority:g});break;case d.pop_up_optimum_vib:this.popups.push({widget:new e.PopUpOptimumVib(b),priority:g});break;case d.pop_up_welcome:this.popups.push({widget:new e.PopUpWelcome(b),priority:g});break;case d.pop_up_blog_redirect:this.popups.push({widget:new e.PopUpBlogRedirect(b),priority:g})}},this),this.popups=b.filter(this.popups,function(a){return a.widget.isViewable()}),this.popups=b.sortBy(this.popups,"priority"),f.subscribe(f.EVENTS.ADD_MANAGED_POPUP,this.boundUnshift),f.subscribe(f.EVENTS.CANCEL_ALL_MANAGED_POPUPS,this.boundEmpty),c(b.bind(this._onWindowReady,this))},g.prototype._onWindowReady=function(){f.unsubscribe(f.EVENTS.ADD_MANAGED_POPUP,this.boundUnshift),f.unsubscribe(f.EVENTS.CANCEL_ALL_MANAGED_POPUPS,this.boundEmpty),this.popups.length>0&&this.popups[0].widget.openPopUp()},g.prototype.unshift=function(a){return this.popups.unshift({priority:0,widget:a})},g.prototype.empty=function(){this.popups=[]}}.call(this),function(a){"use strict";var b=a._,c=NR.resolve("SDM.Core.Components.BrooklynAuth"),d=NR.resolve("SDM.Core.Widgets"),e=SDM.EmailSignup||(SDM.EmailSignup={}),f=NR.resolve("SDM.Subscription"),g=NR.resolve("SDM.Util"),h=c.Repository;d.EmailSignup=function(a){new Vue({created:function(){this.isAuthenticated=e.IsLoggedIn,this.isSignedUp=g.getValueFromCookie("salesforceSubscription"),this.isAuthenticated&&h.getUserEmail().done(b.bind(function(a){this.email=a},this)).fail(b.bind(function(a){console.log(a)},this))},data:function(){return{email:"",errors:{email:!1,isConsenting:!1},instanceId:b.uniqueId("wgEs_"),isAuthenticated:!1,isConsenting:!1,isSending:!1,isSent:!1,isSignedUp:!1}},el:a.get(0),methods:{submit:function(){var a=this.$refs.signupForm.dataset.wgEsCasl||"";this.$refs.email&&(this.errors.email=!(this.email.length&&/\S+@\S+/.test(this.email))),this.$refs.consent&&(this.errors.isConsenting=!this.isConsenting),b.some(this.errors,function(a){return a})||(this.isSending=!0,f.signup(this.email,a).done(b.bind(function(){this.isSent=!0,g.saveCookie("salesforceSubscription","true")},this)).fail(b.bind(function(a){console.log(a)},this)).always(b.bind(function(){this.isSending=!1},this)))}},watch:{email:function(){this.email.length&&(this.errors.email=!1)},isConsenting:function(){this.isConsenting&&(this.errors.isConsenting=!1)}}})}}(this),function(a){"use strict";var b=a.jQuery,c=NR.resolve("SDM.Util"),d=NR.resolve("SDM.Subscription"),e=NR.resolve("SDM.Core.Components.BrooklynAuth.Repository"),f=a.SDM||(a.SDM={}),g=f.EmailSignupPopup||(f.EmailSignupPopup={}),h=NR.resolve("SDM.Core.Widgets"),i=h.EmailSignupPopup=function(a,c){c=c||{};var d={popupCookieName:"emailSignupPopup",subscriptionCookieName:"salesforceSubscription",isLoggedIn:"True"===g.IsLoggedIn,modalScrollY:window.scrollY,selectors:{close_button:"[data-wg-es-close-button]",modal:"[data-wg-es-modal]"}},e=b.extend(!0,{},d,c);this._init(a,e)};i.prototype._init=function(a,f){var g="",h=f.isLoggedIn,i=c.getValueFromCookie(f.popupCookieName),j=c.getValueFromCookie(f.subscriptionCookieName);i||j||(h?e.getUserEmail().done(function(b){g=b,d.isEmailSubscribed(g).done(function(b){b&&this._showPopup(a,f)}).fail(function(a){console.log(a)})}).fail(function(a){console.log(a)}):this._showPopup(a,f)),a.find(f.selectors.close_button).click(_.bind(function(){this._hidePopup(a,f)},this)),a.find(f.selectors.modal).click(_.bind(function(c){0===b(c.target).closest(".wg-esp__content-container").length&&a.hasClass("wg-esp--visible")&&this._hidePopup(a,f)},this))},i.prototype._showPopup=function(a,c){a.addClass("wg-esp--visible"),a.find(c.selectors.modal).velocity({top:"0%"},500,[210,19],function(){var c=b('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',a).first();c.length&&c.focus()}),setTimeout(function(){b(document.body).css("top","-"+c.modalScrollY+"px"),b(document.body).css("position","fixed"),b(document.body).css("width","100%")},0)},i.prototype._hidePopup=function(a,d){a.removeClass("wg-esp--visible"),a.find(d.selectors.modal).velocity({top:"100%"},300),setTimeout(function(){b(document.body).css("position",""),b(document.body).css("top",""),b(document.body).css("width","%"),window.scrollTo(0,d.modalScrollY)},0),c.saveCookie(d.popupCookieName,"true")}}(this),function(a){"use strict";var b=a.jQuery,c=NR.resolve("SDM.Util"),d=NR.resolve("SDM.Core.Widgets");(d.ImagePopup=function(a,c){c=c||{};var d={popupCookieName:"imagePopup",selectors:{content:"[data-wg-pu-content]",modal:'[data-widget="image-pop-up"]',modalCloseButton:"[data-wg-pu-hide-modal]"}},e=b.extend(!0,{},d,c);this._init(a,e)}).prototype._init=function(a,e){var f=c.getValueFromCookie(e.popupCookieName),g=a.find(e.selectors.modal);!f&&g.length>0&&new d.PopUp(g)._showModal(),a.find(e.selectors.modalCloseButton).on("click",function(){c.saveCookie(e.popupCookieName,"true")}),a.find(e.selectors.modal).on("click",_.bind(function(){0===b(event.target).closest(e.selectors.content).length&&c.saveCookie(e.popupCookieName,"true")},this))}}(this),function(a){"use strict";var b=a.NR||(a.NR={}),c=b.resolve("SDM.Core.Widgets"),d=b.resolve("SDM.Vue.Widgets"),e=b.resolve("SDM.Vue.Stores"),f=b.resolve("SDM.Data.FluShotFinderBanner");c.FluShotFinderBanner=function(a){var c=b.resolve("SDM.Vue.Vuex");c.hasModule("provinceSelector")||c.registerModule("provinceSelector",e.ProvinceSelector),new Vue({el:a[0],store:c,components:{provinceSelector:d.ProvinceSelector},mixins:[],data:function(){return{searchHeadline:"",searchSubHeading:"",searchDescription:""}},mounted:function(){this.updateSearchHeadline(this.userProvinceId)},methods:{updateSearchHeadline:function(a){this.searchHeadline=f.SearchHeadlinesPerProvince[a]},updateSearchSubHeadline:function(a){this.searchSubHeading=f.SearchSubHeadlinesPerProvince[a]},updateSearchDescription:function(a){this.searchDescription=f.SearchFieldDescriptionPerProvince[a]}},computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{}),watch:{userProvinceId:function(){this.updateSearchHeadline(this.userProvinceId),this.updateSearchSubHeadline(this.userProvinceId),this.updateSearchDescription(this.userProvinceId)}}})}}(this),function(a){var b=a._,c=a.jQuery,d=a.Vue,e=a.NR,f=e.resolve("SDM.Util"),g=e.resolve("SDM.Core.Widgets"),h=e.resolve("SDM.QuickSearchFrequencyDelay")||50,i=4,j={DEFAULT:"all",ARTICLES:"Article",CONDITIONS:"Condition",PRODUCTS:"Products"},k={ARTICLE:"Article",BRAND:"Brand",CATEGORIE:"Category",CONDITION:"Condition",PRODUCT:"Product"},l=function(a,b){switch(a){case k.CONDITION:return b.AllConditions;case k.PRODUCT:return b.AllProducts;default:return null}},m=function(a,c){if(!a)return[];var d=null,e=b.map(a.StructuredResult,function(c){var d=c.Filter,e=c.FilterName,f=l(d,a),g=d===k.PRODUCT||d===k.BRAND;return{categoryType:d,suggestions:b.map(((c.Result||{}).records||{}).page||[],function(a,b){return{suggestionId:d+"_"+String(b),imageUrl:g?a.image||"":"",title:a.title,url:a.url}}),title:e,viewAllLabel:f}});return c===j.DEFAULT&&a.FAQ.length&&(d={title:a.FAQLabel||"",suggestions:b.map(a.FAQ,function(a){return{title:a.Title,url:a.Link}})},e=e.concat(d)),b.filter(e,function(a){return a.suggestions.length>0})},n={beforeCreate:function(){this.API_URL="/"+f.getShortLanguageCode()+"/search/getstructuredsearch",this.FACET_MODES=j,this.focusTimeout=null},computed:{isDropdownOpen:function(){return this.isContainsFocusedEl&&(this.isFetchingSuggestions||this.allSuggestions.length||this.isShowErrorMessage||this.isShowNoResultsMessage)},allSuggestions:function(){return Array.prototype.concat.apply([],b.map(this.suggestionCategories,function(a){return a.suggestions}))},selectedSuggestion:function(){return-1===this.selectedIndex?null:this.allSuggestions[this.selectedIndex]}},created:function(){this.debouncedFetchSuggestion=b.debounce(this.fetchSuggestions,h),this.isPrefillQuery&&(this.query=(f.getUrlVars()||{}).query||"")},data:function(){return{currentRequest:null,hasFocus:!1,isContainsFocusedEl:!1,isFetchingSuggestions:!1,isShowErrorMessage:!1,isShowNoResultsMessage:!1,noResultsMessage:"",selectedIndex:-1,suggestionCategories:[],query:""}},methods:{decrementSelectedIndex:function(){this.isFetchingSuggestions||(this.selectedIndex-=1,this.selectedIndex<0&&(this.selectedIndex=0))},fetchSuggestions:function(){if(this.isShowErrorMessage=!1,this.isShowNoResultsMessage=!1,this.isFetchingSuggestions=!1,this.currentRequest&&this.currentRequest.abort(),this.query.length=this.allSuggestions.length&&(this.selectedIndex=this.allSuggestions.length-1))},makeViewAllUrl:function(a){return"/search?query="+encodeURIComponent(this.query)+"&srhtype="+encodeURIComponent(a.title.toLowerCase())},onFocusChange:function(){this.focusTimeout&&clearTimeout(this.focusTimeout),this.focusTimeout=setTimeout(b.bind(function(){var a=document.activeElement;this.hasFocus=b.some(this.$el.querySelectorAll("*"),function(b){return b===a})},this),50),this.focusTimeout=setTimeout(b.bind(function(){this.isContainsFocusedEl=this.hasFocus},this),h)},onNonSuggestionFocus:function(){this.selectedIndex=-1,this.onFocusChange()},onSubmit:function(){this.isShowErrorMessage=!1,this.isShowNoResultsMessage=!1,this.selectedIndex=-1,this.suggestionCategories=[],this.currentRequest&&(this.currentRequest.abort(),this.isFetchingSuggestions=!1)},onSuggestionFocus:function(a){this.selectedIndex=b.findIndex(this.allSuggestions,function(b){return b.suggestionId===a},this),this.onFocusChange()}},props:{errorMessage:{default:"",required:!1,type:String},facetMode:{default:j.DEFAULT,required:!1,type:String,validator:function(a){return b.indexOf(b.map(Object.keys(j),function(a){return j[a]}),a)>-1}},filters:{default:"",required:!1,type:String},hasAltStyling:{default:!1,required:!1,type:Boolean},isAlwaysSmallSubmit:{default:!1,required:!1,type:Boolean},inputPlaceholder:{required:!0,type:String},isPrefillQuery:{default:!1,required:!1,type:Boolean},submitLabel:{required:!0,type:String}},template:"#SearchBarV2Template",watch:{isContainsFocusedEl:function(){this.isContainsFocusedEl&&this.query&&!this.suggestionCategories.length&&this.fetchSuggestions()},query:function(){this.debouncedFetchSuggestion()},selectedSuggestion:function(){if(this.selectedSuggestion){var a=this.selectedSuggestion.suggestionId;this.$refs[a].length&&this.$refs[a][0].focus()}}}};g.SearchBar=function(a){new d({components:{searchBar:n},el:a.get(0)})}}(this),function(a,b){var c=a.NR||(a.NR={}),d=c.resolve("SDM.Core.Modules"),e=c.resolve("SDM.Core.Widgets"),f=c.resolve("SDM.Util"),g=a._,h=d.StoreLocatorPerService=function(a,c){c=c||{};var d={$el:a,selectors:{searchForm:"[data-md-slps-search-form]",searchInput:"[data-md-slps-search-input]",searchError:"[data-md-slps-search-error]",finder:"[data-md-slps-finder]",map:"[data-md-slps-map]",finderLoading:"[data-md-slps-finder-loading]",store:"[data-md-slps-store]",storeList:"[data-md-slps-store-list]",storeListPrevious:"[data-md-slps-store-list-previous]",storeListNext:"[data-md-slps-store-list-next]",storeHourPopUp:"[data-slps-store-hours-pop-up]",storeInfoStore:"[data-md-slps-store-info-store]",storeInfoStoreHours:"[data-md-slps-store-info-store-hours]"},classes:{storeListCollapse:"md-slps__store-list--collapse",loadingVisible:"md-slps__loading--visible"},data:{storeId:"md-slps-store-id",storeInfoStoreId:"md-slps-store-info-store-id",storeInfoStoreHoursId:"md-slps-store-info-store-hours-id",serviceCodes:"md-slps-service-codes",customPinSrc:"md-slps-custom-pin-src",markerLabel:"md-slps-marker-label"},templates:{storeList:"#store-locator-per-service-store-list-template",storeInfo:"#store-locator-per-service-store-info-template"},mapOptions:{center:{lat:43.6532,lng:-79.3832},zoom:10},stores:{},storeNotificationStores:{},storeListCurrentPage:1,storeHoursPopUps:{}};this.config=b.extend(!0,{},d,c);var e=SDM.Util.loadGoogleMapsApi();!0===e?this._init():b.when(e).then(g.bind(function(){this._init()},this))};h.prototype._init=function(){this._initMap(),this._initPopUps(),this._initSearch()},h.prototype._initGeolocation=function(){b.when(this._getGeolocation()).then(g.bind(function(a){if(a){var b=a.coords.latitude,c=a.coords.longitude;this.map.setCenter({lat:b,lng:c}),this._getStores({latitude:b,longitude:c,radius:"500",unit:"km",lookup:"nearby",filters:this.config.$el.data(this.config.data.serviceCodes).split(",").map(function(a){return a+":TRUE"}).join(","),rpp:"3"})}},this))},h.prototype._getGeolocation=function(){var a=b.Deferred();return navigator.geolocation?navigator.geolocation.getCurrentPosition(function(b){a.resolve(b)},function(b){console.log(b),a.resolve(null)}):a.resolve(null),a.promise()},h.prototype._initSearch=function(){var a=b(this.config.$el.find(this.config.selectors.searchForm)),c=a.find(this.config.selectors.searchInput),d=f.getUrlVars(),e=d.search;e&&""!==e?(c[0].value=decodeURIComponent(e),this._searchFormSubmit()):this._initGeolocation(),a.submit(g.bind(this._onSearchFormSubmit,this))},h.prototype._onSearchFormSubmit=function(a){this._searchFormSubmit(),a.preventDefault()},h.prototype._searchFormSubmit=function(){var a=b(this.config.$el.find(this.config.selectors.searchForm)),c=a.find(this.config.selectors.searchInput),d=c[0].value;""!==d&&(f.setUrlVars({search:d}),this.config.storeListCurrentPage=1,this._queryMap(d))},h.prototype._initMap=function(){this.config.mapOptions.mapTypeId=a.google.maps.MapTypeId.ROADMAP,this.map=new a.google.maps.Map(b(this.config.selectors.map)[0],this.config.mapOptions),this.geocoder=new a.google.maps.Geocoder,this.markers=[]},h.prototype._initPopUps=function(){var a=b(this.config.$el.find(this.config.selectors.storeNotificationPopUp));this.config.storeNotificationPopUp=new e.PopUp(a);var c=b(this.config.$el.find(this.config.selectors.storeReminderPopUp));this.config.storeReminderPopUp=new e.PopUp(c)},h.prototype._queryMap=function(a){this.geocoder.geocode({address:a},g.bind(this._geocoderCallback,this))},h.prototype._geocoderCallback=function(b,c){if(c===a.google.maps.GeocoderStatus.OK){this.config.$el.find(this.config.selectors.searchError).hide();var d=b[0].geometry.location;this.map.setCenter(d),this._getStores({latitude:d.lat(),longitude:d.lng(),radius:"500",unit:"km",lookup:"nearby",filters:this.config.$el.data(this.config.data.serviceCodes).split(",").map(function(a){return a+":TRUE"}).join(","),rpp:"3"})}else this.config.$el.find(this.config.selectors.searchError).show()},h.prototype._getStores=function(a){this._clearAllMarkers(),this.config.$el.find(this.config.selectors.finderLoading).addClass(this.config.classes.loadingVisible),b.ajax({method:"GET",url:"/"+f.getShortLanguageCode()+"/store/getstores",data:a}).done(g.bind(function(a){a&&(this.config.storeHoursPopUps={},this._renderStoreList(JSON.parse(a)),this._addMarkerToMap(JSON.parse(a)),this.config.$el.find(this.config.selectors.finderLoading).removeClass(this.config.classes.loadingVisible),this._initStorePopUp(JSON.parse(a).results))},this)).fail(function(a){console.log(a)})},h.prototype._addMarkerToMap=function(a){if(0!==a.results.length){this.bounds=new google.maps.LatLngBounds;for(var c=g.template(b(this.config.templates.storeInfo).html()),d=0;d 0){this.config.$el.find(this.config.selectors.storeList).removeClass(this.config.classes.storeListCollapse);var c=g.template(b(this.config.templates.storeList).html());this.config.$el.find(this.config.selectors.storeList).html(c({storeList:a.results,storeListCurrentPage:this.config.storeListCurrentPage,isStoreListLastPage:3*this.config.storeListCurrentPage>=a.count})),this.config.$el.find(this.config.selectors.storeListPrevious).on("click",g.bind(this._onStoreListPreviousClick,this,a)),this.config.$el.find(this.config.selectors.storeListNext).on("click",g.bind(this._onStoreListNextClick,this,a))}else this.config.$el.find(this.config.selectors.storeList).addClass(this.config.classes.storeListCollapse),this.config.$el.find(this.config.selectors.searchError).show()},h.prototype._onStoreListPreviousClick=function(a){this.config.storeListCurrentPage-=1,this._getStores(this._getUrlParametersAsObject(a.previous))},h.prototype._onStoreListNextClick=function(a){this.config.storeListCurrentPage+=1,this._getStores(this._getUrlParametersAsObject(a.next))},h.prototype._getUrlParametersAsObject=function(a){return JSON.parse('{"'+decodeURI(a).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')},h.prototype._initStorePopUp=function(a){for(var c=0;c 0&&(this.hasCoupons=!0,this._initializePersonalizedCoupon(a)),a.find(this.config.selectors.recommended_flyer_products_container).length>0&&this._initializeRecommendedCoupon(a),m.subscribe(m.EVENTS.TAB_SWITCHED,b.bind(function(a){a.tabId===this.config.tab_ids.recommended_flyer&&this._updateFlyer()},this))},l.prototype._initializePersonalizedCoupon=function(a){var d=c(this.config.selectors.no_results_templates.loaded_coupons),e=c(this.config.selectors.no_results_templates.no_loaded_coupons);this.card=f.getInstance(),this.couponCollection=new g;var i=new h({model:this.couponCollection,getNoResultsHtml:b.bind(function(){return this.card.getLoadedCoupons().size()>0?d.html():e.html()},this)});i.overrideAddItemViewMethod(b.bind(function(a,b,c,d){d.isContinuityOptIn()&&c.addContinuityOptInClass(),b.html(c.el),a.append(b)},this)),this.$couponContainer=a.find(this.config.selectors.personalized_coupon_container),this.$viewAllCouponsButtonContainer=a.find(this.config.selectors.view_all_coupons_btn_container),this.$couponContainer.html(i.el),this.couponCollection.onCouponRemoveComplete(function(){this._updatePersonlizedCoupons()},this),this.couponCollection.onListSet(this._toggleViewAllCouponsButton,this),this.card.onSimpleDataReady(b.bind(function(){this._updatePersonlizedCoupons(),this._pushPersonalizedCouponAnalytics()},this)).getAllCoupons().onCouponLoaded(b.bind(function(a){this._removePersonlizedCoupons(a)},this)),this.card.fetchSimpleData()},l.prototype._updatePersonlizedCoupons=function(){var a=this.card.getExclusiveContinuityOptInCoupons().add(this.card.getExclusiveCoupons().models).first(3);this.couponCollection.setList(a).fetchDetails()},l.prototype._removePersonlizedCoupons=function(a){this.couponCollection.removeCoupons(a)},l.prototype._toggleViewAllCouponsButton=function(){var a=this.card.getAllAvailableCoupons().size()>0;this.$viewAllCouponsButtonContainer.toggle(a)},l.prototype._initializeRecommendedCoupon=function(a){this.flyerModelCollection=new i,this.flyerViewModelCollection=new i,this.$flyerContainer=a.find(this.config.selectors.recommended_flyer_products_container),this.flyerListView=new j({model:this.flyerViewModelCollection}),this.$flyerContainer.html(this.flyerListView.el),this.flyerModelCollection.fetchSimple().done(b(function(){this.flyerViewModelCollection.setList(this.flyerModelCollection.first(6)).fetchDetails()}).bind(this)).fail(b(function(){this.flyerViewModelCollection.trigger("error-fetch")}).bind(this))},l.prototype._updateFlyer=function(){this.flyerListView.adjustTextAreaSize()}}.call(this),function(){var a=this,b=a.jQuery,c=a.NR||(a.NR={}),d="sdm-overlay",e=c.resolve("SDM.Core.Modules"),f=e.Overlays=function(a,c){var d={selectors:{close:"[data-md-ovl-close]",grey_bg:"[data-md-ovl-gry]",overlay:"[data-md-ovl-oly]",background:"[data-md-ovl-bg]",image:"[data-md-ovl-image]",html:"html"}};this.config=b.extend(!0,d,c||{}),this.$element=a,this._initialize(a)};f.prototype._initialize=function(){this._setInstanceVars(),b(window).on("becometowide."+d,_(function(){this._switchModeToDesktop()}).bind(this)),b(window).on("becometonarrow."+d,_(function(){this._switchModeToMobile()}).bind(this)),SDM.Util.isWindowWide()&&this._openOverlay()},f.prototype._setInstanceVars=function(){this.$image=b(this.config.selectors.image),this.imageLoaded=SDM.Util.loadImage(this.$image.attr("src")),this.$close=b(this.config.selectors.close),this.$grey_bg=b(this.config.selectors.grey_bg),this.$overlay=b(this.config.selectors.overlay),this.$background=b(this.config.selectors.background),this.$html=b(this.config.selectors.html)}, f.prototype._openOverlay=function(){this.imageLoaded.done(_.bind(function(){var a=this.$background.height();this.$grey_bg.css({height:a}),this.$html.css("overflow","hidden"),this.$grey_bg.fadeIn(),this.$overlay.fadeIn(),this.$element.css("overflow","auto");var b=_(this._closeOverlay).bind(this);this.$close.off("click."+d).on("click."+d,b)},this))},f.prototype._switchModeToMobile=function(){this._closeOverlay()},f.prototype._switchModeToDesktop=function(){this._openOverlay()},f.prototype._closeOverlay=function(){this.$element.css("overflow","hidden").fadeOut(),this.$html.css("overflow","auto")}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e=d.SharedSimpleRouter.getInstance(),f=a.Accordion,g=a.NR||(a.NR={}),h=g.resolve("SDM.Core.Modules"),i=h.AccordionContentList=function(a,b){var d={selectors:{accordion:"[data-wg-acl-accordion]",accordion_button:"[data-wg-acl-accordion-button]",accordion_content:"[data-wg-acl-accordion-content]"},attributes:{content_id:"data-wg-acl-content-id",is_first_item_expanded:"data-wg-acl-is-first-item-expanded",use_router:"data-wg-acl-use-router"},moveDuration:300,useRouter:!1};this.config=c.extend(!0,d,b||{}),this._initialize(a)};i.prototype._initialize=function(a){this.useRouter="true"===a.attr(this.config.attributes.use_router),this.isFirstItemExpanded=!this.useRouter&&"true"===a.attr(this.config.attributes.is_first_item_expanded),this.accordion$Elements=b(a.find(this.config.selectors.accordion)).map(b(function(a){var b=c(a);return{id:b.attr(this.config.attributes.content_id),$element:b}}).bind(this)),this.accordionObjects=b(this.accordion$Elements).map(b(function(a){var b=new f(a.$element,{selectors:{button:this.config.selectors.accordion_button,content:this.config.selectors.accordion_content}});return{id:a.id,accordion:b}}).bind(this)),this.useRouter&&(this.$scrollParent=this.$scrollParent||c("html, body"),this._setupRouter(),this._bindClickEvent()),this.isFirstItemExpanded&&this.accordionObjects.length&&b(this.accordionObjects).first().accordion.open()},i.prototype._openAccordion=function(a){return b(this.accordionObjects).find(function(b){return b.id===a}).accordion.open()},i.prototype._closeAccordionsExcept=function(a){var d=[];return b(this.accordionObjects).each(function(b){b.id!==a&&d.push(b.accordion.close())}),c.when.apply(c,d)},i.prototype._moveToAccordion=function(a){var c=b(this.accordion$Elements).find(function(b){return b.id===a}).$element;return this.$scrollParent.animate({scrollTop:c.offset().top-SDM.Util.getScrollOffset()},this.config.moveDuration).promise()},i.prototype._moveToTop=function(){return this.$scrollParent.animate({scrollTop:0},this.config.moveDuration).promise()},i.prototype._setupRouter=function(){var a=b(this.accordionObjects).map(function(a){return a.id}),d=new RegExp("^(?!"+a.join("|")+")");e.on(d,b(function(){this._closeAccordionsExcept(null).done(b(function(){this._moveToTop()}).bind(this))}).bind(this)),b(this.accordionObjects).each(b(function(a){e.on(a.id,b(function(){c.when(this._openAccordion(a.id),this._closeAccordionsExcept(a.id)).done(b(function(){this._moveToAccordion(a.id)}).bind(this))}).bind(this))}).bind(this)),e.historyStart()},i.prototype._bindClickEvent=function(){b(this.accordionObjects).each(function(a){a.accordion.onClickButton(b(function(){e.navigate(a.id,{trigger:!0})}).bind(this))})}}.call(this),function(a){"use strict";var b=a.jQuery,c=a._,d=a.NR||(a.NR={}),e=d.resolve("SDM"),f=d.resolve("SDM.Core.Modules"),g=d.resolve("SDM.Core.Components.Blog"),h=e.Util,i=g.BlogHeader,j=g.BlogHeaderView;(f.BeautyBlogPostDetails=function(a,c){c=c||{};var d={classes:{active_categories_toggle_btn:"wg-bbh-categories-toggle-active",search_term_input_expanded:"wg-bbh-search-input-expanded"},data_attributes:{title:"md-bbpd-title",tweet_via:"md-bbpd-tweet-via"},selectors:{categories:"[data-wg-bbh-categories]",categories_toggle_btn:"[data-wg-bbh-cat-toggle-btn]",header:"[data-widget-beauty-blog-header]",search:"[data-wg-bbh-list-search]",search_form:"[data-wg-bbh-search-form]",search_term_input:'[name="q"]',facebook_btn:"[data-md-bbpd-facebook-btn]",pinterest_btn:"[data-md-bbpd-pinterest-btn]",twitter_btn:"[data-md-bbpd-twitter-btn]",image:"[data-md-bbpd-image]"}};this.config=b.extend(!0,{},d,c),this.$element=a,this._initialize(this.$element,this.config)}).prototype._initialize=function(d,e){this.title=d.data(e.data_attributes.title)||"",this.$image=d.find(this.config.selectors.image),new j({el:b(this.config.selectors.header,d).get(0),model:new i,config:this.config}),h.loadPinterestApi(),b(this.config.selectors.facebook_btn,d).on("click",c.bind(function(a){var b=this.$image.attr("src");0===b.indexOf("//")&&(b="https:"+b),FB.ui({method:"feed",display:"popup",link:document.location.href,name:this.title,picture:b.length>0?b:null},c.noop),a.preventDefault()},this)),b(this.config.selectors.pinterest_btn,d).on("click",c.bind(function(b){a.PinUtils&&a.PinUtils.pinOne({url:document.location.href,media:this.$image.attr("src")||"",description:this.title}),b.preventDefault()},this)),b(this.config.selectors.twitter_btn,d).on("click",c.bind(function(d){var e=b(d.currentTarget),f=e.attr("href"),g=document.location.href,h=e.data(this.config.data_attributes.tweet_via)||"",i={url:g,text:this.title.substring(0,140),via:h};f+="?"+c.map(i,function(a,b){return b+"="+encodeURIComponent(a)}).join("&"),a.open(f,"twitter_share_dialog","width=550,height=450"),d.preventDefault()},this))}}(this),function(a){"use strict";var b=a.jQuery,c=a._,d=a.Backbone,e=a.NR||(a.NR={}),f=e.resolve("SDM.Core.Modules"),g=e.resolve("SDM.Core.Components.Blog"),h=e.resolve("SDM.Util"),i=g.BlogListing,j=g.BlogListingView,k=g.BlogPost,l=g.BlogPostCollection,m=g.Category,n=g.CategoryCollection,o=g.Pagination,p=g.Router,q=g.SortTypeCollection,r=f.BeautyBlogPosts=function(a,c){c=c||{};var d={classes:{active_categories_toggle_btn:"wg-bbh-categories-toggle-active",active_category_item:"wg-bbh-category-item-active",active_sort_item:"md-bbp-sort-item-active",post_image:"wg-bli-image",search_term_input_expanded:"wg-bbh-search-input-expanded"},data_attributes:{api_path:"md-bbp-api-path",category_id:"wg-bbh-cat-id",category_path:"wg-bbh-cat-path",destination_id:"md-bpp-destination-id",featuredcontent_id:"md-bpp-featured-content-id",homepage_title:"md-bbp-home-title",num_results_per_page:"md-bbp-num-results-per-page",pagination_btn_num:"md-bbp-pagination-btn",post_id:"wg-bli-id",post_path_prefix:"md-bbp-post-path-prefix",router_root:"md-bbp-router-root",sort_btn_type:"md-bbp-sort-btn"},selectors:{body:"[data-md-bpp-body]",categories:"[data-wg-bbh-categories]",category_btn:"[data-wg-bbh-cat-btn]",categories_toggle_btn:"[data-wg-bbh-cat-toggle-btn]",clear_category_btn:"[data-md-bbp-cat-clear]",header:"[data-widget-beauty-blog-header]",pagination:"[data-md-bbp-pagination]",no_results_template:"[data-md-bbp-no-results-tmpl]",no_server_template:"[data-md-bbp-no-server-tmpl]",pagination_btn:"[data-md-bbp-pagination-btn]",pagination_btn_next:"[data-md-bbp-pagination-btn-next]",pagination_btn_prev:"[data-md-bbp-pagination-btn-prev]",pagination_template:"[data-md-bbp-pagination-tmpl]",post_loading:"[data-wg-bli-post-loading]",post_template:"[data-md-bbp-post-tmpl]",posts:"[data-md-bbp-posts]",posts_loading_template:"[data-md-bbp-posts-loading-tmpl]",search:"[data-wg-bbh-list-search]",search_form:"[data-wg-bbh-search-form]",search_term_input:'[name="q"]',search_status:"[data-md-bbp-search-status]",search_status_template:"[data-md-bbp-search-status-tmpl]",search_clear_btn:"[data-md-bbp-clear-search-btn]",sort_btn:"[data-md-bbp-sort-btn]",sort_type_default:"[data-md-bbp-sort-type-default]",sort_types:"[data-md-bbp-sort-types]",sticky_post:"[data-md-bbp-sticky-post]",sticky_post_template:"[data-md-bbp-sticky-post-tmpl]",sticky_post_image_loading:"[data-md-bbp-sticky-image-loading]",title:"[data-wg-bbh-title]"},speeds:{fade_in:"slow",fade_out:"fast",scroll_duration:.5}};this.config=b.extend(!0,{},d,c),this.$element=a,this._initalize(this.$element,this.config)};r.prototype._initalize=function(a,e){var f=a.data(e.data_attributes.api_path),g=a.data(e.data_attributes.destination_id),h=a.data(e.data_attributes.featuredcontent_id),p=a.data(e.data_attributes.homepage_title),r=a.data(e.data_attributes.num_results_per_page),s=a.data(e.data_attributes.post_path_prefix);k.prototype.path_prefix=s;var t=function(a){var b=a.data(e.data_attributes.category_path)||"/";return 0!==b.indexOf("/")&&(b="/"+b),b},u=new n(c.map(b(e.selectors.category_btn,a),function(a){var c=b(a);return new m({category_id:c.data(e.data_attributes.category_id),path:t(c),title:c.text()||""})},this)),v=new q(c.map(b(e.selectors.sort_btn,a),function(a){var c=b(a);return new d.Model({type:c.data(e.data_attributes.sort_btn_type),is_default:c.is(e.selectors.sort_type_default)})},this)),w=new l([],{url:f}),x=new o({num_results_per_page:r}),y=new i({categories:u,destination_id:g,featuredcontent_id:h,homepage_title:p,pagination_model:x,posts:w,sort_types:v,sort_type:v.getDefault().get("type")});this._initalizeRouter(a,e,y),new j({el:a.get(0),config:e,model:y}).render()},r.prototype._initalizeRouter=function(a,b,e){var f=a.data(b.data_attributes.router_root),g=new p;g.on("route:category",function(a){if(!a)return void e.setCategoryId(null);0!==a.indexOf("/")&&(a="/"+a);var b=e.get("categories").findWhere({path:a});if(!b)return void e.setCategoryId(null);e.setCategoryId(b.id)},this),g.listenTo(e,"set-category-id",function(a){var b=a.getActiveCategory()||a.getNullCategory();g.navigate(b.get("path"))}),g.listenTo(e,"set-search-term",function(a,b){if(c.isEmpty(b))return void g.navigate(a.getNullCategory().get("path"));g.navigate("/search?q="+encodeURIComponent(b))}),g.on("route:search",function(){var a=h.getUrlVars(),b=a.q||"";e.setSearchTerm(b)},this),d.history.start({pushState:!0,root:f})}}(this),function(a){var b=a.jQuery,c=a._,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Modules"),f=d.resolve("SDM.Util");(e.BeautyBrandsListing=function(a,c){c=c||{};var d={animation_duration_sec:500,selectors:{brand_nav:"[data-md-bbl-brand-navigation]",letter_group:"[data-md-bbl-letter-group]"}},e=b.extend(!0,d,c||{});this._init(a,e)}).prototype._init=function(a,d){this.$element=a,this.config=d,this.$element.on("click",this.config.selectors.letter_group,c.bind(function(a){var c=b(a.currentTarget).attr("href"),d=this.$element.find(c);0!==d.length&&f.scrollTo$ElementAsync(d,this.config.animation_duration_sec)},this))}}(this),function(){var a=this,b=a.console,c=a.jQuery,d=a._,e=a.NR||(a.NR={}),f=e.resolve("SDM.Core.Modules"),g=f.BmiCalculator=function(a,b){var d={classes:{custom_radio_button_has_error:"wg-crb-has-error",field_has_error:"md-bmi-calc-calculator-field-has-error"},selectors:{bmi:"[data-md-bmi-calc-bmi]",bmi_container:"[data-md-bmi-calc-bmi-container]",button_submit:"[data-md-bmi-calc-button-submit]",calculator_header:"[data-md-bmi-calc-calculator-header]",custom_radio_button:".widget-custom-radio-button",form:"[data-md-bmi-calc-form]",field:"[data-md-bmi-calc-field]",input_units:'[name="md-bmi-calc-units"]',input_height:'[name="md-bmi-calc-height"]',input_weight:'[name="md-bmi-calc-weight"]',val_error:"[data-md-bmi-calc-val-error]",val_empty_height:"[data-md-bmi-calc-val-empty-height]",val_empty_weight:"[data-md-bmi-calc-val-empty-weight]",val_empty_units:"[data-md-bmi-calc-val-empty-units]",val_invalid_height:"[data-md-bmi-calc-val-invalid-height]",val_invalid_weight:"[data-md-bmi-calc-val-invalid-weight]"}};b=b||{},this.config=c.extend(!0,d,b),this._initialize(a)};g.fn=g.prototype,g.CONSTANTS={MIN_WEIGHT_IN_KG:25,MAX_WEIGHT_IN_KG:250,MIN_HEIGHT_IN_CM:100,MAX_HEIGHT_IN_CM:250,CM_PER_METRE:100,INCHES_PER_CM:2.54,LBS_PER_KG:2.2},g.UNITS={INVALID:0,METRIC:1,IMPERIAL:2},g.DURATIONS={HIDE_RESULT:100,SHOW_RESULT:600,HIDE_VAL_ERRORS:200,SHOW_VAL_ERRORS:400},g.VAL_ERRORS={EMPTY_UNITS:0,EMPTY_HEIGHT:1,EMPTY_WEIGHT:2,INVALID_HEIGHT:3,INVALID_WEIGHT:4},g.fn._initialize=function(a){this.$element=a,this._bindTextInputBlur(),this._bindTextInputKeyDown(),this._bindUnitsChange(),this._bindFormSubmit()},g.fn._bindTextInputBlur=function(){var a=[this.config.selectors.input_height,this.config.selectors.input_weight].join(", ");this.$element.on("blur",a,d.bind(this._onTextInputBlur,this))},g.fn._bindTextInputKeyDown=function(){var a=[this.config.selectors.input_height,this.config.selectors.input_weight].join(", ");this.$element.on("keydown",a,d.bind(this._onTextInputKeyDown,this))},g.fn._bindUnitsChange=function(){var a=this.config.selectors.input_units||"";this.$element.on("change",a,d.bind(this._onUnitsChange,this))},g.fn._bindFormSubmit=function(){var a=this.config.selectors.form||"";this.$element.on("submit",a,d.bind(this._onFormSubmit,this))},g.fn._onFormSubmit=function(a){var b=this._getRawValues()||{},c=this._getValidationErrors(b);0===c.length?(this._hideInvalidFields(d.values(g.VAL_ERRORS)),this._hideAllValidationMessages(),this._updateResult(this._getBmiFromRawValues(b))):(this._showInvalidFields(c),this._updateAllValidationMessages(c)),a.preventDefault()},g.fn._onTextInputBlur=function(a){if(!0!==c(a.relatedTarget).is(this.config.selectors.button_submit)){var b=c(a.currentTarget),d=b.is(this.config.selectors.input_height),e=b.is(this.config.selectors.input_weight),f=this._getRawValues();if((!0!==d||f.height)&&(!0!==e||f.weight)){var h=g.VAL_ERRORS.INVALID_HEIGHT,i=g.VAL_ERRORS.INVALID_WEIGHT,j=this._getValidationErrors(f),k=this._hasError(j,h),l=this._hasError(j,i);!0===d?!0===k?(this._showValidationMessages([h]),this._showInvalidFields([h])):(this._hideValidationMessages([h]),this._hideInvalidFields([h])):!0===e&&(!0===l?(this._showValidationMessages([i]),this._showInvalidFields([i])):(this._hideValidationMessages([i]),this._hideInvalidFields([i])))}}},g.fn._onTextInputKeyDown=function(a){if(13!==(a.keyCode||a.which)){var b=c(a.currentTarget),d=this.config.selectors.input_height,e=this.config.selectors.input_weight,f=[];b.is(d)?f=[g.VAL_ERRORS.EMPTY_HEIGHT,g.VAL_ERRORS.INVALID_HEIGHT]:b.is(e)&&(f=[g.VAL_ERRORS.EMPTY_WEIGHT,g.VAL_ERRORS.INVALID_WEIGHT]),this._hideResult(),this._hideInvalidFields(f),this._hideValidationMessages(f)}},g.fn._onUnitsChange=function(){var a=g.VAL_ERRORS.EMPTY_UNITS,b=g.VAL_ERRORS.INVALID_HEIGHT,c=g.VAL_ERRORS.INVALID_WEIGHT,d=this._getRawValues(),e=this._getValidationErrors(d),f=this._hasError(e,b),h=this._hasError(e,c);this._hideResult(),this._hideInvalidFields([a]),this._hideValidationMessages([a]),d.height&&(!0===f?(this._showValidationMessages([b]),this._showInvalidFields([b])):(this._hideValidationMessages([b]),this._hideInvalidFields([b]))),d.weight&&(!0===h?(this._showValidationMessages([c]),this._showInvalidFields([c])):(this._hideValidationMessages([c]),this._hideInvalidFields([c])))},g.fn._getBmiFromRawValues=function(a){var b=this._parseRawUnits(a.units),c=this._getCentimetres(this._parseRawFloat(a.height),b),d=this._centimetresToMetres(c),e=this._getKilograms(this._parseRawFloat(a.weight),b);return 0===d?0:e/(d*d)},g.fn._getCentimetres=function(a,b){return!1===this._isValidUnits(b)?0:!0===this._isMetric(b)?a:this._inchesToCentimetres(a)},g.fn._getElementChildren=function(a,c){c=c||"";var d=a.find(c);return 0===d.length&&b.log("No child elements exists with selector: ["+c+"]."),d},g.fn._getFormattedBmi=function(a){a=Math.round(100*(a||0))/100;var b=a.toString().split(".");return b[0]+"."+((b[1]||"")+"00").slice(0,2)},g.fn._getKilograms=function(a,b){return!1===this._isValidUnits(b)?0:!0===this._isMetric(b)?a:this._poundsToKilograms(a)},g.fn._getRawValues=function(){return{height:this._getRawHeightValue(),weight:this._getRawWeightValue(),units:this._getRawUnits()}},g.fn._getRawHeightValue=function(){var a=this.config.selectors.input_height||"";return this.$element.find(a).val()||""},g.fn._getRawUnits=function(){var a=this.config.selectors.input_units||"";return this.$element.find(a+":checked").val()||""},g.fn._getRawWeightValue=function(){var a=this.config.selectors.input_weight||"";return this.$element.find(a).val()||""},g.fn._getValidationErrors=function(a){var b=this._parseRawFloat(a.height),c=this._parseRawFloat(a.weight),d=this._parseRawUnits(a.units),e=this._getCentimetres(b,d),f=this._getKilograms(c,d),h=[],i=this._isValidUnits(d);return!1===i&&h.push(g.VAL_ERRORS.EMPTY_UNITS),a.height?b<=0?h.push(g.VAL_ERRORS.INVALID_HEIGHT):!0===i&&!1===this._isValidHeightInCentimetres(e)&&h.push(g.VAL_ERRORS.INVALID_HEIGHT):h.push(g.VAL_ERRORS.EMPTY_HEIGHT),a.weight?c<=0?h.push(g.VAL_ERRORS.INVALID_WEIGHT):!0===i&&!1===this._isValidWeightInKilograms(f)&&h.push(g.VAL_ERRORS.INVALID_WEIGHT):h.push(g.VAL_ERRORS.EMPTY_WEIGHT),h},g.fn._getValidationElementFromError=function(a){return a===g.VAL_ERRORS.EMPTY_UNITS?this._getElementChildren(this.$element,this.config.selectors.val_empty_units).get(0):a===g.VAL_ERRORS.EMPTY_HEIGHT?this._getElementChildren(this.$element,this.config.selectors.val_empty_height).get(0):a===g.VAL_ERRORS.EMPTY_WEIGHT?this._getElementChildren(this.$element,this.config.selectors.val_empty_weight).get(0):a===g.VAL_ERRORS.INVALID_HEIGHT?this._getElementChildren(this.$element,this.config.selectors.val_invalid_height).get(0):a===g.VAL_ERRORS.INVALID_WEIGHT?this._getElementChildren(this.$element,this.config.selectors.val_invalid_weight).get(0):null},g.fn._isMetric=function(a){return a===g.UNITS.METRIC},g.fn._isValidHeightInCentimetres=function(a){return g.CONSTANTS.MIN_HEIGHT_IN_CM<=a&&a<=g.CONSTANTS.MAX_HEIGHT_IN_CM},g.fn._isValidWeightInKilograms=function(a){return g.CONSTANTS.MIN_WEIGHT_IN_KG<=a&&a<=g.CONSTANTS.MAX_WEIGHT_IN_KG},g.fn._isValidUnits=function(a){return a===g.UNITS.METRIC||a===g.UNITS.IMPERIAL},g.fn._hasError=function(a,b){return d.indexOf(a,b)>-1},g.fn._parseRawFloat=function(a){return a&&!0===d.isArray(a.match(/^\d*(\.\d+)?$/))?parseFloat(a):0},g.fn._parseRawUnits=function(a){return a=(a||"").toUpperCase(),g.UNITS[a]||g.UNITS.INVALID},g.fn._centimetresToMetres=function(a){return a/g.CONSTANTS.CM_PER_METRE},g.fn._inchesToCentimetres=function(a){return a*g.CONSTANTS.INCHES_PER_CM},g.fn._poundsToKilograms=function(a){return a/g.CONSTANTS.LBS_PER_KG},g.fn._hideInvalidFields=function(a){var b=this.config.selectors.field||"",c=this.config.classes.field_has_error||"",d=this.config.classes.custom_radio_button_has_error,e=this._hasError(a,g.VAL_ERRORS.EMPTY_UNITS),f=this._hasError(a,g.VAL_ERRORS.EMPTY_HEIGHT)||this._hasError(a,g.VAL_ERRORS.INVALID_HEIGHT),h=this._hasError(a,g.VAL_ERRORS.EMPTY_WEIGHT)||this._hasError(a,g.VAL_ERRORS.INVALID_WEIGHT);return!0===e&&this._getElementChildren(this.$element,this.config.selectors.custom_radio_button).removeClass(d),!0===f&&this._getElementChildren(this.$element,this.config.selectors.input_height).parents(b).first().removeClass(c),!0===h&&this._getElementChildren(this.$element,this.config.selectors.input_weight).parents(b).first().removeClass(c),this},g.fn._showInvalidFields=function(a){var b=this.config.selectors.field||"",c=this.config.classes.field_has_error||"",d=this.config.classes.custom_radio_button_has_error||"",e=this._hasError(a,g.VAL_ERRORS.EMPTY_UNITS),f=this._hasError(a,g.VAL_ERRORS.EMPTY_HEIGHT)||this._hasError(a,g.VAL_ERRORS.INVALID_HEIGHT),h=this._hasError(a,g.VAL_ERRORS.EMPTY_WEIGHT)||this._hasError(a,g.VAL_ERRORS.INVALID_WEIGHT);return!0===e&&this._getElementChildren(this.$element,this.config.selectors.custom_radio_button).addClass(d),!0===f&&this._getElementChildren(this.$element,this.config.selectors.input_height).parents(b).addClass(c),!0===h&&this._getElementChildren(this.$element,this.config.selectors.input_weight).parents(b).addClass(c),this},g.fn._hideAllValidationMessages=function(){return this._getElementChildren(this.$element,this.config.selectors.val_error).hide(),this},g.fn._hideValidationMessages=function(a){var b=c.map(a,d.bind(this._getValidationElementFromError,this));c(b).fadeOut()},g.fn._showValidationMessages=function(a){var b=g.DURATIONS.SHOW_VAL_ERRORS||"slow",e=c.map(a,d.bind(this._getValidationElementFromError,this));return c(e).fadeIn(b),this},g.fn._updateAllValidationMessages=function(a){return this._hideAllValidationMessages(),this._showValidationMessages(a),this},g.fn._hideResult=function(a){a=a||d.noop,this._getElementChildren(this.$element,this.config.selectors.bmi_container).slideUp(g.DURATIONS.HIDE_RESULT,a)},g.fn._showResult=function(a){this._getElementChildren(this.$element,this.config.selectors.bmi).text(this._getFormattedBmi(a)),this._getElementChildren(this.$element,this.config.selectors.bmi_container).slideDown(g.DURATIONS.SHOW_RESULT)},g.fn._updateResult=function(a){var b=function(){this._showResult(a)};this._hideResult(d.bind(b,this))}}.call(this),function(){var a=this,b=a.jQuery,c=a._,d=a.NR||(a.NR={}),e=d.resolve("SDM.Core.Modules"),f=d.resolve("SDM.Core.Utils"),g=d.resolve("SDM.ContactUs.Forms"),h=d.resolve("SDM.Util"),i=f.ReCaptchaFactory,j=e.ContactUs=function(a,c){var d={urls:{answers_by_question:"/search/GetAllResultsByQuery"},rating_helpful:100,rating_unhelpful:0,character_limit:100,character_limit_label:"{0}",character_limit_delay:2e3,scroll_to_customer_help_duration_ms:1e3,inquiry:{selectors:{detail_forms:"[data-md-ctus-inquiry-detail-forms]",selected_category:"[data-md-ctus-inquiry-selected-category]",detail_template:"[data-md-ctus-inquiry-detail-tmpl]",inquiry_dropdown:"[data-md-ctus-inquiry-dropdown]",next_button:"[data-inquiry-next-button]",back_button:"[data-inquiry-back-button]",submit_button:"[data-inquiry-submit-button]"}},classes:{help_toggle_expanded:"md-ctus__customer-help-toggle--expanded"},selectors:{customer_help:"[data-md-ctus-customer-help]",customer_help_toggle:"[data-ctus-customer-help-toggle]",radio_container:"[data-md-ctus-inquiry-radio-container]"}};this.config=b.extend(!0,d,c||{}),this._initialize(a)};j.fn=j.prototype,j.fn._initialize=function(a){this.$element=a,this.$element.on("click",this.config.selectors.customer_help_toggle,c.bind(function(){b(this.config.selectors.customer_help,this.$element).is(":visible")?this._closeHelpSection():this._openHelpSection()},this)),this.$element.on("keydown",c.bind(function(a){var c=b(event.target);if(c.is(this.config.selectors.radio_container)){a.which===32&&(b('input[type="radio"]',c).prop("checked",!0),a.preventDefault())}},this)),this._initializeInquiry()},j.fn._initializeInquiry=function(){var a=c.template(b(this.config.inquiry.selectors.detail_template,this.$element).html());b(this.config.inquiry.selectors.detail_forms).html(a({inquireForms:g.Data})),this.$element.on("change",this.config.inquiry.selectors.selected_category,c.bind(this._onInquiryCategoryChange,this)),this.$element.on("click",this.config.inquiry.selectors.next_button,c.bind(this._onInquiryNextButtonClick,this)),this.$element.on("click",this.config.inquiry.selectors.back_button,c.bind(this._onInquiryBackButtonClick,this)),this.$element.on("click",this.config.inquiry.selectors.submit_button,c.bind(this._onInquirySubmitButtonClick,this)),this.$element.on("keydown","[data-inquiry-input=pcoptimum]",c.bind(this._onPCOptimumInputKeyDown,this)),this.$element.on("keydown","[data-inquiry-input=phone]",c.bind(this._onPhoneInputKeyDown,this)),this.$element.on("keydown","[data-inquiry-input=numeric]",c.bind(this._onNumericInputKeyDown,this));var d=this.$element.find("[data-md-ctus-inquiry-detail-form]");this.reCaptcha=[];for(var e=0;e 0&&(b("[data-inquiry-submit-button="+h+"]")[0].disabled=!1)}},j.fn._renderReCaptcha=function(a,d){i.getReCaptchaAsync().done(c.bind(function(e){this.reCaptcha[d]=e,e.render(a,c.bind(function(a){a.length>0&&(b("[data-inquiry-submit-button="+d+"]")[0].disabled=!1)},this),c.bind(function(){b("[data-inquiry-submit-button="+d+"]")[0].disabled=!0},this))},this))},j.fn._onInquiryCategoryChange=function(a){this.$element.find(this.config.inquiry.selectors.next_button)[0].disabled=!1,a.preventDefault()},j.fn._onPCOptimumInputKeyDown=function(a){var c=b(a.currentTarget).find("input");b.isNumeric(a.key)&&19!==c[0].value.length||8===a.keyCode||9===a.keyCode||a.preventDefault()},j.fn._onPhoneInputKeyDown=function(a){var c=b(a.currentTarget).find("input");b.isNumeric(a.key)&&10!==c[0].value.length||8===a.keyCode||9===a.keyCode||a.preventDefault()},j.fn._onNumericInputKeyDown=function(a){b.isNumeric(a.key)||8===a.keyCode||9===a.keyCode||a.preventDefault()},j.fn._onInquiryNextButtonClick=function(a){var c=b("option:selected",b(this.config.inquiry.selectors.selected_category)),d=c.val();this.$element.find("[data-md-ctus-inquiry-selection]").hide(),this.$element.find("[data-md-ctus-inquiry-detail-form="+d+"]").show(),this.$element.find("[data-md-ctus-inquiry-detail-form="+d+"] .md-ctus__inquiry-heading").focus(),h.scrollTo$ElementAsync(b(".md-ctus__inquiry")),a.preventDefault()},j.fn._onInquiryBackButtonClick=function(a){this.$element.find("[data-md-ctus-inquiry-detail-form]").hide(),this.$element.find("[data-md-ctus-inquiry-selection]").show(),this.$element.find("[data-md-ctus-inquiry-selection] .md-ctus__inquiry-heading").focus(),h.scrollTo$ElementAsync(b(".md-ctus__inquiry")),a.preventDefault()},j.fn._onInquirySubmitButtonClick=function(a){var c=b(a.currentTarget).parents("form"),d=this;this._validateForm(c)&&(g.Payload.reason_code_level_1__c=b(c).data().inquiryReason,g.Payload.Banner_Email__c=b(c).data().inquiryBannerEmail,this._fillPayload(c,g.Payload,""),h.scrollTo$ElementAsync(b(".md-ctus__inquiry")),b("[data-md-ctus-inquiry-loading]").show(),b.ajax({contentType:"application/x-www-form-urlencoded",type:"POST",url:"/Global/SubmitInquiry",data:{data:JSON.stringify(g.Payload)}}).done(function(a){var c=JSON.parse(a);"OK"===c.Status?(b("[data-md-ctus-inquiry-external-id]")[0].innerHTML=g.Payload.web_external_id__c,b("[data-md-ctus-inquiry-case-id]")[0].innerHTML=c.CaseID):"FAIL"===c.Status&&(b("[data-md-ctus-inquiry-response]")[0].innerHTML=c.ErrorMessage)}).always(function(){b("[data-md-ctus-inquiry-detail-form]").hide(),b("[data-md-ctus-inquiry-loading]").hide(),b("[data-md-ctus-inquiry-response]").show(),d.$element.find("[data-md-ctus-inquiry-response]").focus()})),a.preventDefault()},j.fn._fillPayload=function(a,b,c){for(var d in b)if(b.hasOwnProperty(d)){var e=a.find("[data-inquiry-key='"+c+d+"']");if(0!==e.length){var f=e.data().inquiryInput,g=e.find("input, textarea, select");"radio"===f&&(g=e.find("input:checked")),0!==g.length&&(b[d]="postal"===f?g[0].value.replace(/\s/g,""):g[0].value)}else"object"==typeof b[d]&&this._fillPayload(a,b[d],c+d+",")}},j.fn._validateForm=function(a){for(var c=a.find("[data-inquiry-input]"),d=!0,e=!1,f=0;f 0&&(10!==u.value.length||!/^\d+$/.test(u.value))){j[0].innerHTML=l,d=!1,e=this._setFirstInputFocus(u,e);continue}}else if("email"===i){var v=/^(([abcdefg.hijklmnopqrstuvwxyz!#$%&'*/=?^_+-`{|}~0123456789]+))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(u.value.length>0&&!v.test(u.value)){j[0].innerHTML=l,d=!1,e=this._setFirstInputFocus(u,e);continue}}else if("numeric"===i){if(u.value.length>0&&!/^\d+$/.test(u.value)){j[0].innerHTML=l,d=!1,e=this._setFirstInputFocus(u,e);continue}}else if("postal"===i){if(u.value.length>0&&!h.validatePostalCode(u.value)){j[0].innerHTML=l,d=!1,e=this._setFirstInputFocus(u,e);continue}}else if("pcoptimum"===i&&u.value.length>0&&(19!==u.value.length||!/^\d+$/.test(u.value))){j[0].innerHTML=l,d=!1,e=this._setFirstInputFocus(u,e);continue}if(o){var w=a.find("[data-inquiry-confirmation-id="+p+"] input");if(w[0].value!==w[1].value){j[0].innerHTML=m,d=!1,e=this._setFirstInputFocus(w[1],e);continue}}}}return d},j.fn._setFirstInputFocus=function(a,c){return c||(a.focus(),h.scrollTo$ElementAsync(b(a),500,20)),!0},j.fn._openHelpSection=function(){var a=this.config.classes.help_toggle_expanded||"",c=b(this.config.selectors.customer_help,this.$element);c.stop().slideDown(),c.addClass(a)},j.fn._closeHelpSection=function(){var a=this.config.classes.help_toggle_expanded||"",c=b(this.config.selectors.customer_help,this.$element);c.stop().slideUp(),c.removeClass(a)}}.call(this),function(){var a,b,c,d,e,f,g,h,i=this,j=i._,k=i.jQuery,l=i.Backbone,m=i.NR||(i.NR={}),n=m.resolve("SDM.Core.Components"),o=m.resolve("SDM.Core.Modules"),p=o.VideoPlayerMVC=function(a,b){var c={attributes:{add_rating_endpoint:"data-md-vpm-add-rating-url",filter_view:"data-wg-tbg-content",get_paginated_videos_endpoint:"data-md-vpm-get-paginated-videos-url",get_video_by_friendly_name_endpoint:"data-md-vpm-get-video-by-friendly-name-url",increment_views_endpoint:"data-md-vpm-increment-views-url",root_url:"data-md-vpm-root-url"},classes:{now_playing_container_hidden:"md-vpm-now-playing-hidden",tab_content_active:"wg-tcl-active",tab_hidden:"md-vpm-tab-hidden"},selectors:{active_tab_content:".wg-tcl-active",module_wrapper:"[data-vpm-mod-wrapper]",now_playing_details:"[data-md-vpm-now-playing-details]",tab_content_template:"[data-md-vpm-tab-content-template]",tab_filter_selector:"[data-vpm-tabs-select]",video_item_template:"[data-md-vpm-video-item-template]",video_player_container:"[data-md-vpm-video-player-container]",video_player_template:"[data-md-vpm-video-player-template]"},most_recent_tab_button:"most-recent",video_base_url:"details/"};this.config=k.extend(!0,c,b||{}),this._initialize(a)},q=m.resolve("SDM"),r=m.resolve("SDM.Core.Components.VideoPlayer"),s=n.PaginationModel,t=n.PaginationView;d=l.Model.extend({config:{rating_cookie:"ShoppersVideoStats",v3_youtube_api_key:"AIzaSyAqyipvzq62aB7-5OZ35FiVAp4T2WszDTM"},idAttribute:"Id",defaults:{Cats:"",Duration:"0:00",Friendly:"",MaxRating:5,Rating:1,RatingsCount:0,ThumbnailUrl:"",Title:"",Views:0},getExternalData:function(){if(!0===j.isEmpty(this.get("YouId"))&&!0===j.isEmpty(this.get("VimId")))return this.trigger("external-data-failed"),void console.log("A vimeo id or a youtube id is required on the video.");var a=this.get("YouId"),b=this.get("VimId");a?k.when(this.getYoutubeVideoData(a)).then(j(this.handleYoutubeVideoDataResponse).bind(this)).fail(j(function(){this.trigger("external-data-failed")}).bind(this)):b&&k.when(this.getVimeoVideoData(b)).then(j(this.handleVimeoVideoDataResponse).bind(this)).fail(function(){this.trigger("external-data-failed")})},getFormattedDuration:function(a){if(!0===j.isUndefined(a))return this.defaults.Duration;if(!0===j.isNaN(a))return this.defaults.Duration;var b=a%60,c=Math.floor(a/60),d=Math.floor(a/3600);return d>0?d+":"+("00"+c).slice(-2)+":"+("00"+b).slice(-2):c+":"+("00"+b).slice(-2)},getFormattedRating:function(a){return!0===j.isUndefined(a)?this.defaults.Rating:!0===j.isNaN(a)?this.defaults.Rating:Math.min(Math.round(a),this.defaults.MaxRating)},getFormattedThumbnailUrl:function(a){if(!0===j.isUndefined(a))return this.defaults.thumbnail_url;var b=this.get("VideoThumbnail");return b&&!0===b.hasOwnProperty("URL")?b.URL:a},getFormattedViews:function(a){ if(!0===j.isUndefined(a))return this.defaults.Views;if(!0===j.isNaN(a))return this.defaults.Views;for(var b=a.toString(),c=/(\d+)(\d{3})/;!0===c.test(b);)b=b.replace(c,"$1, $2");return b},getYoutubeId:function(a){var b="";if(!(a.indexOf("?v=")>-1))return a.substring(a.lastIndexOf("/")+1);var c=a.match(/[.]*?v=([^&]*)?/);return c.length>1&&(b=c[1]),b},getYoutubeVideoData:function(a){var b=this.config.v3_youtube_api_key,c="https://www.googleapis.com/youtube/v3/videos?id="+a+"&key="+b+"&part=snippet,contentDetails";return k.ajax({dataType:"jsonp",method:"GET",url:c}).fail(j(function(){this.trigger("external-data-failed")}).bind(this))},parseYoutubeApiV3DurationIntoSeconds:function(a){var b=new RegExp(/^PT((\d*)H)?((\d*)M((\d*)S)?)?/i),c=b.exec(a);return 60*(parseInt(c[2],10)||0)*60+60*(parseInt(c[4],10)||0)+(parseInt(c[6],10)||0)},getVimeoVideoData:function(a){return k.ajax({dataType:"jsonp",method:"GET",url:"//vimeo.com/api/v2/video/"+a+".json"})},handleYoutubeVideoDataResponse:function(a){if(!a.items||!a.items.length)return void this.trigger("external-data-failed");var b,c;a.items[0].snippet&&a.items[0].snippet.thumbnails&&a.items[0].snippet.thumbnails.high&&(b=a.items[0].snippet.thumbnails.high.url,this.set("ThumbnailUrl",this.getFormattedThumbnailUrl(b),{silent:!0})),a.items[0].contentDetails&&a.items[0].contentDetails.duration&&(c=a.items[0].contentDetails.duration,this.set("Duration",this.getFormattedDuration(this.parseYoutubeApiV3DurationIntoSeconds(c)),{silent:!0})),this.trigger("external-data-loaded")},handleVimeoVideoDataResponse:function(a){!1!==j.isArray(a)&&!1!==j.isObject(a[0])&&(!0===j.has(a[0],"duration")&&this.set("Duration",this.getFormattedDuration(a[0].duration),{silent:!0}),!0===j.has(a[0],"thumbnail_medium")&&this.set("ThumbnailUrl",this.getFormattedThumbnailUrl(a[0].thumbnail_medium),{silent:!0}),this.trigger("external-data-loaded"))},getRatedIdsFromCookie:function(){var a=q.Util.getValueFromCookie(this.config.rating_cookie);return a?decodeURIComponent(a).split(","):[]},isRated:function(){for(var a=this.getRatedIdsFromCookie(),b=0,c=a.length;b 1&&this.$pagination_container.show(),this}}),p.prototype._initialize=function(a){this.$element=a,this.current_video=new e,this.tab_content_views={};var b=this.$element.find(this.config.selectors.module_wrapper);return this.is_now_playing_video_container_hidden=b.length>0&&b.is("."+this.config.classes.now_playing_container_hidden),this.add_rating_endpoint=this.$element.attr(this.config.attributes.add_rating_endpoint),Boolean(this.add_rating_endpoint)?(this.increment_views_endpoint=this.$element.attr(this.config.attributes.increment_views_endpoint),Boolean(this.increment_views_endpoint)?(this.get_paginated_videos_endpoint=this.$element.attr(this.config.attributes.get_paginated_videos_endpoint),Boolean(this.get_paginated_videos_endpoint)?(this.get_video_by_friendly_name_endpoint=this.$element.attr(this.config.attributes.get_video_by_friendly_name_endpoint),Boolean(this.get_video_by_friendly_name_endpoint)?(this.root_url=this.$element.attr(this.config.attributes.root_url),Boolean(this.root_url)?(this._setupPrototypesVars(),this._setupTabGroups(a),this._setupTabContentViews(),this._setupNowPlayingViews(),this.current_video.on("user-selected-video-set",function(a){this.setPlayingVideo(a,!0,!0)},this),this.current_video.on("default-video-set",function(a){this.setPlayingVideo(a,!1,!1)},this),void this._setupRouter()):void console.log("A "+this.config.attributes.root_url+" attribute is required.")):void console.log("A "+this.config.attributes.get_video_by_friendly_name_endpoint+" attribute is required.")):void console.log("A "+this.config.attributes.get_paginated_videos_endpoint+" attribute is required.")):void console.log("A "+this.config.attributes.increment_views_endpoint+" attribute is required.")):void console.log("A "+this.config.attributes.add_rating_endpoint+" attribute is required.")},p.prototype.setCurrentVideoUrl=function(a){var b=this.config.video_base_url;this.router.navigate(b+a)},p.prototype._setupPrototypesVars=function(){e.prototype.get_paginated_videos_endpoint=this.get_paginated_videos_endpoint,e.prototype.get_video_by_friendly_name_endpoint=this.get_video_by_friendly_name_endpoint,d.prototype.add_rating_endpoint=this.add_rating_endpoint,d.prototype.increment_views_endpoint=this.increment_views_endpoint,h.prototype.events=h.prototype.events||{},h.prototype.events["click [md-vpm-listing-item-thumbnail]"]="onThumbnailClick",h.prototype.template=j.template(k("[data-md-vpm-video-list-item-template]").html()),h.prototype.loading_template=j.template(k("[data-md-vpm-video-list-item-loading-template]").html()),h.prototype.current_video=this.current_video},p.prototype._setupTabGroups=function(){this.filter_select=this.$element.find(this.config.selectors.tab_filter_selector),this.filter_select.on("change",j(function(){this.clearPlayingVideo();var a=this.filter_select.val();this._triggerTabViewReload(a),this.router.navigate(a)}).bind(this))},p.prototype._triggerTabViewReload=function(a,b){b=b||{};var c=this.tab_content_views[a].model,d=this._getContentViewElementWrapped(a);if(this._setActiveTab(d),0===c.get("current_page"))c.set("current_page",1,{trigger_scroll:!1,ignore_set_default_video:b.has_default_video});else{var e=c.get("videos");e.size()>0?this.setPlayingVideo(e.first(),!1,!1):this.hideNowPlayingContainer()}},p.prototype._getContentViewElementWrapped=function(a){return k("["+this.config.attributes.filter_view+"="+a+"]")},p.prototype._setActiveTab=function(a){typeof a!==k&&(a=k(a)),this.$element.find("."+this.config.classes.tab_content_active).removeClass(this.config.classes.tab_content_active),a.addClass(this.config.classes.tab_content_active)},p.prototype._setupNowPlayingViews=function(){this.now_playing_player_view=new b({el:this.config.selectors.video_player_container,model:this.current_video})},p.prototype._setupTabContentViews=function(){this.filter_select.find("option").each(j(function(a,b){var c=k(b),d=c.val(),h=this._getContentViewElementWrapped(d);if(!h.length)return void console.log("Cannot find corresponding tab view for label: "+d+".");var i=h.attr("data-md-vpm-sort-id")||"0",j=h.attr("data-md-vpm-category-id")||"",l=new e,m=new g({sort:i,category_id:j,videos:l});l.on("reset",function(a,b){b=b||{},0===this.current_video.size()&&(a.size()>0?(!0===this.is_now_playing_video_container_hidden&&this.showNowPlayingContainer(),b.ignore_set_default_video||this.current_video.setAsDefault(a.first())):this.hideNowPlayingContainer())},this),l.on("start-loading",function(){this.clearPlayingVideo()},this);var n=new f({el:h,model:m});n.on("video-selected",this.setCurrentVideo,this),this.tab_content_views[d]=n}).bind(this))},p.prototype.hideNowPlayingContainer=function(){return this.is_now_playing_video_container_hidden=!0,this.$element.find(this.config.selectors.module_wrapper).addClass(this.config.classes.now_playing_container_hidden),this},p.prototype.showNowPlayingContainer=function(){return this.is_now_playing_video_container_hidden=!1,this.$element.find(this.config.selectors.module_wrapper).removeClass(this.config.classes.now_playing_container_hidden),this},p.prototype.scrollToVideoContainer=function(){var a=this.$element.find(this.config.selectors.video_player_container),b=a.offset().top-q.Util.getScrollOffset()-30;TweenLite.to(k("body, html"),.5,{scrollTop:b})},p.prototype.setPlayingVideo=function(b,c,d){d=d&&!0===q.Util.isWindowWide(),this.current_video.reset(b,{trigger:!0}),!0===c&&b.get("Friendly")&&this.setCurrentVideoUrl(b.get("Friendly"));var e=this.$element.find(this.config.selectors.now_playing_details),f=new a({model:b});f.render(),e.html(f.el),this.now_playing_player_view.render(d),!0===this.is_now_playing_video_container_hidden&&this.showNowPlayingContainer(),this.scrollToVideoContainer()},p.prototype.clearPlayingVideo=function(){this.current_video.reset([],{trigger:!0}),this.$element.find(this.config.selectors.now_playing_details).empty()},c=l.Router.extend({routes:{"":"home","details(/:id)":"video",":tab":"tab","*notFound":"home"}}),p.prototype._setupRouter=function(){this.router=new c,this.router.on("route:home",this._navigateToDefaultRoute,this),this.router.on("route:video",function(a){if(!0===j.isNull(a))return void this._navigateToDefaultRoute();this._triggerTabViewReload(this.config.most_recent_tab_button,{has_default_video:!0}),this.current_video.fetchVideoByFriendlyName(a)},this),this.router.on("route:tab",function(a){!0===j.has(this.tab_content_views,a)?this.filter_select.val(a).trigger("change"):this._navigateToDefaultRoute()},this);var a=this.root_url;"/"!==a.charAt(a.length-1)&&(a+="/"),l.history.start({pushState:!0,root:a})},p.prototype._navigateToDefaultRoute=function(){this.router.navigate(this.filter_select.find("option").first().val(),{trigger:!0})}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e=a.NR||(a.NR={}),f=e.resolve("SDM.Core.Components.PopUp"),g=e.resolve("SDM.Core.Modules"),h="promo-badge";PromoBadge=g.PromoBadge=function(a,b){var d={selectors:{badge:"[data-md-pb-badge]"}};this.config=c.extend(!0,d,b||{}),this.$element=a,this._initialize()},PromoBadge.prototype._initialize=function(){this.modal=new PromoBadge.Modal,this._bindEvents()},PromoBadge.prototype._bindEvents=function(){var a=this.$element.find(this.config.selectors.badge),c=b(this._openModal).bind(this);a.on("click",c)},PromoBadge.prototype._openModal=function(){this.modal.open()},PromoBadge.Modal=d.View.extend({config:{selectors:{image_pc:"[data-md-pb-modal-image-pc]",image_mobile:"[data-md-pb-modal-image-mobile]",content:"[data-md-pb-modal-content]"}},initialize:function(){this.render();var a=this.$(this.config.selectors.image_pc),b=this.$(this.config.selectors.image_mobile),d=this.createImageLoadPromise(a),e=this.createImageLoadPromise(b);this.$window=c(window),this.has_pc_images=a.length>0,this.has_mobile_images=b.length>0,this.image_loader_promise=c.when([d,e]).promise()},isAbleToShowPopup:function(){return SDM.Util.isWindowWide()&&this.has_pc_images||!SDM.Util.isWindowWide()&&this.has_mobile_images},open:function(){this.image_loader_promise.done(b.bind(function(){this.isAbleToShowPopup()&&(this.popup=new f,this.popup.open(this.el),this.popup.onCloseCompleted(b(function(){this.unbindResizeEvents()}).bind(this)),this.bindResizeEvents())},this))},render:function(){var a=b.template(c("[data-md-pb-modal-tamplate]").html());this.setElement(a())},createImageLoadPromise:function(a){var d=b(a).map(function(a){var b=c.Deferred(),d=new Image;return c(d).on("load",function(){b.resolve()}),d.src=a.src,b.promise()});return c.when(d).promise()},switchModeToPC:function(){this.popup&&!this.has_pc_images&&this.popup.close()},switchModeToMobile:function(){this.popup&&!this.has_mobile_images&&this.popup.close()},bindResizeEvents:function(){this.$window.on("becometowide."+h+"-"+this.cid,b(this.switchModeToPC).bind(this)),this.$window.on("becometonarrow."+h+"-"+this.cid,b(this.switchModeToMobile).bind(this))},unbindResizeEvents:function(){this.$window.off("becometowide."+h+"-"+this.cid),this.$window.off("becometonarrow."+h+"-"+this.cid)}})}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR,e=d.resolve("SDM.Util"),f=d.resolve("SDM.Core.Modules"),g=d.resolve("SDM.PharmacyServicesList.Data"),h=d.resolve("SDM.Vue.Stores"),i=d.resolve("SDM.Vue.Widgets"),j="on",k=c(window),l=b.reduce(g.Categories,function(a,b){var c=b.Slug||(b.Title||"").toLowerCase().replace(/\s/g,"-");return a[c]={categoryId:String(b.ContentID),body:b.Body,legal:b.Legal,slug:c,title:b.Title,featuredArticle:b.FeaturedArticle,featuredArticleUrl:b.FeaturedArticleUrl},a},{}),m=function(a,c){c=c||{};var d=b.map(a,function(a){return{id:a.Abbreviation.toLowerCase(),label:a.Title.toLowerCase()}});return c.isExcludeQc&&(d=b.filter(d,function(a){return"qc"!==a.id})),d},n=function(a){return c.ajax({type:"GET",url:"/"+e.getShortLanguageCode()+"/PharmacyServices/GetServices",data:{province:a},contentType:"application/json; charset=utf-8",dataType:"json"}).then(function(a){var c=b.map(a,function(a){var b=a.PharmacyService;if(!b)return null;var c=(a.SafeTitle||"").toLowerCase();if(!c)return null;var d=null;return a.OverrideUrl&&(d={href:a.OverrideUrl,target:a.OverrideUrlTarget,text:a.OverrideUrlText}),{serviceId:c,categoryId:b.PharmacyServiceCategoryID?String(b.PharmacyServiceCategoryID):null,bodyHtml:b.Description,title:b.Title,url:d}});return b.filter(c,Boolean)})},o=function(a,c){return!(!a.length||!c)&&b.contains(b.map(a,function(a){return a.categoryId}),c)},p=function(a,c){return!(!a.length||!c)&&b.contains(b.map(a,function(a){return a.id}),c.toLowerCase())},q=function(a,c){return!(!a.length||!c)&&b.contains(b.map(a,function(a){return a.serviceId}),c.toLowerCase())};f.PharmacyServiceList=function(f){var r=d.resolve("SDM.Vue.Vuex");r.hasModule("provinceSelector")||r.registerModule("provinceSelector",h.ProvinceSelector),new Vue({beforeCreate:function(){this.isPharmaprix=(a.location.hostname||"").indexOf("pharmaprix")>-1,this.hasProvinceSelect=!this.isPharmaprix},beforeDestroy:function(){k.off("becometonarrow becometowide becometosmalldesktopwide becometoextrawide",this.onChangeBreakpoint)},components:{"province-selector":i.ProvinceSelector},computed:Object.assign({},Vuex.mapState("provinceSelector",["userProvinceId"]),{pageColumnWidth:function(){return Math.floor(100/this.maxNumServiceColumns)},selectedCategory:function(){return this.categorySlug?this.categoriesToShow.find(function(a){return a.slug===this.categorySlug},this)||null:null},servicePages:function(){return this.servicesToShow.length?b.reduce(this.servicesToShow,function(a,b,c){var d=c%this.maxNumServiceColumns;return a[d]||(a[d]=[]),a[d].push(b),a},[],this):[]},servicesToShow:function(){this.categorySlug||(this.categorySlug=g.Categories[0].Slug);var a=l[this.categorySlug];return a?this.services.filter(function(b){return b.categoryId===a.categoryId},this):this.services}}),created:function(){var a=e.getUrlVars(),b=a.province||this.userProvinceId||null;this.provinces=this.isPharmaprix?[]:m(g.Provinces,{isExcludeQc:!0}),this.setUserProvinceId(this.isPharmaprix?"qc":p(this.provinces,b)?b:null),this.isShowShareLocationPrompt=!this.userProvinceId,this.categorySlug=(a.category||"").toLowerCase()||null,this.serviceId=(a.service||"").toLowerCase()||null},data:function(){return{categoriesToShow:[],categorySlug:null,isLoading:!1,isShowShareLocationPrompt:!1,maxNumServiceColumns:3,provinces:[],serviceId:null,services:[]}},el:f.get(0),filters:{uppercase:function(a){return(a||"").toUpperCase()}},methods:Object.assign({},Vuex.mapActions("provinceSelector",["setUserProvinceId"]),{closeServiceEl:function(a,b){TweenLite.to(a,.4,{height:0,onComplete:b})},fetchServices:function(){this.isLoading=!0,n(this.userProvinceId).then(b.bind(function(a){this.services=a},this)).catch(function(a){console.error(a)}).always(b.bind(function(){this.isLoading=!1},this))},geoLocateUser:function(){var a=new c.Deferred;this.isShowShareLocationPrompt=!1,navigator.geolocation?navigator.geolocation.getCurrentPosition(function(b){a.resolve({lat:b.coords.latitude,lng:b.coords.longitude})},function(b){console.error(b),a.reject(b)}):a.reject(new Error("geolocation is not supported")),a.promise().then(function(a){return e.getProvinceId(a)}).then(b.bind(function(a){this.setUserProvinceId(a)},this)).catch(b.bind(function(a){console.error(a),this.setUserProvinceId(j)},this))},onChangeBreakpoint:function(){e.isWindowNarrow()?this.maxNumServiceColumns=1:e.isWindowWide()?this.maxNumServiceColumns=2:this.maxNumServiceColumns=3},openServiceEl:function(a,b){TweenLite.set(a,{height:"auto"}),TweenLite.from(a,.4,{height:0,onComplete:b})},selectService:function(a){this.serviceId=a,this.updateQuerystring()},setCategorySlug:function(a){this.categorySlug=a,this.updateQuerystring()},updateQuerystring:function(){var a={};!this.isPharmaprix&&this.userProvinceId&&(a.province=this.userProvinceId),this.categorySlug&&(a.category=this.categorySlug),this.serviceId&&(a.service=this.serviceId),e.setUrlVars(a)},useDefaultProvinceId:function(){this.isShowShareLocationPrompt=!1,this.setUserProvinceId(j)}}),mounted:function(){k.on("becometonarrow becometowide becometosmalldesktopwide becometoextrawide",this.onChangeBreakpoint),this.onChangeBreakpoint()},store:r,watch:{isShowShareLocationPrompt:function(){this.$refs.shareLocationPrompt&&(this.isShowShareLocationPrompt?this.$nextTick(b.bind(function(){b.each(document.body.querySelectorAll("button, [href], input, select, textarea"),function(a){a.tabIndex=-1}),b.each(this.$refs.shareLocationPrompt.querySelectorAll("button, [href], input, select, textarea"),function(a,b){a.tabIndex=0,0===b&&a.focus()})},this)):this.$nextTick(b.bind(function(){b.each(document.body.querySelectorAll("button, [href], input, select, textarea"),function(a){a.tabIndex=0})},this)))},userProvinceId:function(){this.userProvinceId?this.fetchServices():this.services=[],this.updateQuerystring()},services:function(){this.services.length?this.categoriesToShow=b.filter(b.map(b.keys(l),function(a){return l[a]}),function(a){return b.any(this.services,function(b){return b.categoryId===a.categoryId})},this):this.categoriesToShow=[],o(this.categoriesToShow,this.categoryId)||(this.categoryId=null),q(this.services,this.serviceId)||(this.serviceId=null),this.updateQuerystring()},servicesToShow:function(){q(this.servicesToShow,this.serviceId)||(this.serviceId=null),this.updateQuerystring()}}})}}(),function(){var a=this,b=a._,c=a.jQuery,d=a.NR,e=d.resolve("SDM.Util"),f=d.resolve("SDM.Core.Modules"),g=null,h=f.PharmacyServiceDetail=function(a,b,d){var e={url:"/PharmacyServices/GetServices",scrolled:!1,scrollOffset:SDM.Util.getScrollOffset()+10,selectors:{provinces_select:"[data-md-phsd-provinces-select]",provinces_label:"[data-md-phsd-province-label]",details_template:"[data-md-phsd-detail-template]",details_container:'[data-service-list="all"]',loading_template:"[data-md-phsd-loading-template]",accordion:"[data-md-phsd-accordion]",accordion_button:"[data-md-phsd-accordion-button]",accordion_content:"[data-md-phsd-accordion-content]",scroll_top:"[data-md-phsd-scroll-top]",scroll_to:"[data-md-phsd-scroll-to]"},attributes:{scroll_to:"data-md-phsd-scroll-to",link_name:"data-md-phsd-link-name"}};this.config=c.extend(!0,e,d||{}),this._initialize(a,b)};h.prototype._initialize=function(a,d){g=g||c("html, body"),this._setInstantVars(a,d),this.$provinces_select.on("change.pharmacy-services-details",b(this._updateList).bind(this)),this.$provinces_select.val(this.province).triggerHandler("change")},h.prototype._setInstantVars=function(a,d){this.$container=a,this.$details_container=this.$container.find(this.config.selectors.details_container),this.details_template=b.template(this.$container.find(this.config.selectors.details_template).html()||""),this.loading_template=b.template(this.$container.find(this.config.selectors.loading_template).html()||"");var e=SDM.Util.getUrlVars();this.service=e.service,this.service&&(this.service=this.service.toLowerCase()),this.province=e.province,this.province&&(this.province=this.province.toLowerCase()),this.$provinces_select=this.$container.find(this.config.selectors.provinces_select);var f=b(this.$provinces_select.find("option")).map(function(a){return c(a).val()});this.province||b.contains(f,this.province)||(this.province=(d||"").toLowerCase()),b.contains(f,this.province)||(this.province=f[0])},h.prototype._updateList=function(){this._showLoading(),this.province=this.$provinces_select.val(),this.provinceName=this.$provinces_select.find(":selected").text(),this.$container.find(this.config.selectors.provinces_label).html(this.provinceName),c.when(this._fetchList()).then(b(this._renderList).bind(this))},h.prototype._showLoading=function(){this.$details_container.html(this.loading_template())},h.prototype._fetchList=function(){return c.ajax({type:"GET",url:"/"+e.getShortLanguageCode()+this.config.url,data:{province:this.province},contentType:"application/json; charset=utf-8",dataType:"json"})},h.prototype._renderList=function(a){var d=this.details_template({services:a,active_service:this.service,province:this.province}),e={selectors:{button:this.config.selectors.accordion_button,content:this.config.selectors.accordion_content}};this.$details_container.html(d),this._updateQueryString(),b(this.$details_container.find(this.config.selectors.accordion)).each(function(a){var b=new Accordion(c(a),e);b.isActive()&&b.open(0)}),this._scrollToActive(),this._bindEvents()},h.prototype._bindEvents=function(){var a=b(this._scrollToTop).bind(this);this.$container.find(this.config.selectors.scroll_top).on("click",a);var c=b(this._changeActiveService).bind(this);this.$container.find(this.config.selectors.scroll_to).on("click",c)},h.prototype._updateQueryString=function(){var a=SDM.Util.getUrlVars();a.province=this.province,a.service=this.service,SDM.Util.setUrlVars(a)},h.prototype._changeActiveService=function(a){a.preventDefault();var b=c(a.currentTarget);this.service=b.attr(this.config.attributes.scroll_to),this._updateQueryString(),this._scrollToActive()},h.prototype._scrollToActive=function(){ var a=null;this.service&&""!==this.service&&(a=this.$container.find("["+this.config.attributes.link_name+"="+this.service+"]"),a.length>0&&this._scroll(a.offset().top))},h.prototype._scrollToTop=function(a){a.preventDefault(),this._scroll(0)},h.prototype._scroll=function(a){g.animate({scrollTop:a-this.config.scrollOffset},1e3)}}.call(this),function(){var a=this,b=a.NR,c=b.resolve("SDM.PharmacistQA");c.Initializer={init:function(){app=new Vue({el:"#pharmacist-qa",data:function(){return{isVideo:!0}},created:function(){},mounted:function(){},methods:{onVideoTabClick:function(){this.isVideo=!0},onTranscriptTabClick:function(){this.isVideo=!1}}})}},document.querySelector("#pharmacist-qa")&&c.Initializer.init()}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.NR,e=d.resolve("SDM.Util"),f=d.resolve("SDM.Core.Modules"),g=null,h=f.MinorAilmentsList=function(a,b,d){var e={url:"/PharmacyServices/GetMinorAilments",scrolled:!1,scrollOffset:SDM.Util.getScrollOffset()+10,selectors:{provinces_select:"[data-md-mal-provinces-select]",provinces_label:"[data-md-mal-province-label]",details_template:"[data-md-mal-detail-template]",details_container:"[data-md-mal-details-container]",loading_template:"[data-md-mal-loading-template]",accordion:"[data-md-mal-accordion]",accordion_button:"[data-md-mal-accordion-button]",accordion_content:"[data-md-mal-accordion-content]",scroll_top:"[data-md-mal-scroll-top]",scroll_to:"[data-md-mal-scroll-to]"},attributes:{scroll_to:"data-md-mal-scroll-to",link_name:"data-md-mal-link-name"}};this.config=c.extend(!0,e,d||{}),this._initialize(a,b)};h.prototype._initialize=function(a,d){g=g||c("html, body"),this.friendly_urls={},this._setInstantVars(a,d),this.$provinces_select.on("change.minor-ailments-list",b(this._updateList).bind(this)),this.$provinces_select.val(this.province).triggerHandler("change")},h.prototype._setInstantVars=function(a,d){this.$container=a,this.$details_container=this.$container.find(this.config.selectors.details_container),this.details_template=b.template(this.$container.find(this.config.selectors.details_template).html()||""),this.loading_template=b.template(this.$container.find(this.config.selectors.loading_template).html()||"");var e=SDM.Util.getUrlVars();this.province=e.province,this.province&&(this.province=this.province.toLowerCase()),this.$provinces_select=this.$container.find(this.config.selectors.provinces_select);var f=b(this.$provinces_select.find("option")).map(function(a){return c(a).val()});this.province||b.contains(f,this.province)||(this.province=(d||"").toLowerCase()),b.contains(f,this.province)||(this.province=f[0])},h.prototype._updateList=function(){this._showLoading(),this.province=this.$provinces_select.val(),this.provinceName=this.$provinces_select.find(":selected").text(),this.$container.find(this.config.selectors.provinces_label).html(this.provinceName),c.when(this._fetchList()).then(b(this._renderList).bind(this))},h.prototype._showLoading=function(){this.$details_container.html(this.loading_template())},h.prototype._fetchList=function(){return c.ajax({type:"GET",url:"/"+e.getShortLanguageCode()+this.config.url,data:{province:this.province},contentType:"application/json; charset=utf-8",dataType:"json"})},h.prototype._renderList=function(a){this.friendly_urls=b.reduce(a,function(a,b){return a[b.Title.toLowerCase()]=b.UrlFriendlyName,a},{});var d=SDM.Util.getUrlVars();d.ailment&&b.each(this.friendly_urls,function(a,b){if(a===d.ailment)return void(this.ailment=b)},this);var e=this.details_template({ailments:a,active_ailment:this.ailment||null,province:this.province}),f={selectors:{button:this.config.selectors.accordion_button,content:this.config.selectors.accordion_content}};this.$details_container.html(e),this._updateQueryString(),b(this.$details_container.find(this.config.selectors.accordion)).each(function(a){var b=new Accordion(c(a),f);b.isActive()&&b.open(0)}),this._bindEvents(),this.ailment&&this._scrollToActive()},h.prototype._bindEvents=function(){var a=b(this._scrollToTop).bind(this);this.$container.find(this.config.selectors.scroll_top).on("click",a);var c=b(this._changeActiveAilment).bind(this);this.$container.find(this.config.selectors.scroll_to).on("click",c)},h.prototype._updateQueryString=function(){var a=SDM.Util.getUrlVars(),b=this.friendly_urls[this.ailment];a.province=this.province,b&&(a.ailment=b),SDM.Util.setUrlVars(a)},h.prototype._changeActiveAilment=function(a){a.preventDefault();var b=c(a.currentTarget);this.ailment=b.attr(this.config.attributes.scroll_to),this._updateQueryString(),this._scrollToActive()},h.prototype._scrollToActive=function(){var a=null;this.ailment&&""!==this.ailment&&(a=this.$container.find("["+this.config.attributes.link_name+'="'+this.ailment+'"]'),a.length>0&&this._scroll(a.offset().top))},h.prototype._scrollToTop=function(a){a.preventDefault(),this._scroll(0)},h.prototype._scroll=function(a){g.animate({scrollTop:a-this.config.scrollOffset},1e3)}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.Backbone,e=a.NR||(a.NR={}),f=e.resolve("SDM.Core.Modules"),g=e.resolve("SDM.Core.Components"),h=g.CollapsibleButtonList,i=g.PaginationModel,j=g.PaginationView,k=f.BrandDetails=function(){new k.View};k.Model=d.Model.extend({defaults:{page:1,numRes:12,filters:{},prducts:{},type:"Product",categoryId:-1,isLBV:!1,getFilters:!0,numberOfPages:0,totalNumberOfResults:0},initialize:function(a,b){this.set("filters",new k.FilterModules),this.set("products",new k.Products),this.setBrand(b.brands),this.fetch();var c=this.getFilters();this.on("change:page",this.fetchNextPage),this.listenTo(c,"filters-updated",this.fetchWithNewFilter)},setBrand:function(a){var c=[];a=a.split(","),b.each(a,function(a){var b=new k.FilterModule.FilterOption;b.setValues(null,a,0,!0,1,a),c.push(b)},this),this.addFilters("BR","",c),this.addFilters("CAT","",[])},addFilters:function(a,b,c){this.get("filters").addFilter(a,b,c)},toJSON:function(){var a=b.clone(this.attributes),c=this.generateFilterString();return a.filters="type,"+this.get("type")+","+c,a=b.omit(a,["type","numberOfPages","totalNumberOfResults","products"])},generateFilterString:function(){var a=this.get("filters"),c=[];return a.each(function(a){var d=a.getType(),e=a.getSelectedOptions();b.isEmpty(e)?c.push(d+":"):b.each(e,function(a){c.push(d+":"+encodeURIComponent(a.getValue()))})}),c.join(",")},fetchWithNewFilter:function(){this.set({page:1},{silent:!0}),this.fetch()},fetchNextPage:function(){this.set("getFilters",!1),this.fetch()},fetch:function(){this.trigger("fetch-start"),c.ajax({url:this.url(),type:"POST",data:this.toJSON(),success:b(this.parse).bind(this),error:function(){console.log("error")}})},parse:function(a){var c=a.FilterModules;b.each(c,function(a){if(!b.isNull(a)){var c=a.Info[0],d=c.Prefix.replace(":",""),e=c.FilterName,f=[],g=0;b.each(a.Results,function(a){var b=new k.FilterModule.FilterOption;b.setValues(a.Type,a.Name,a.TotalResults,null,g,a.Id),f.push(b),g+=1},this),this.addFilters(d,e,f)}},this);var d=a.SwiftypeResults.records.page,e=[];b.each(d,function(a){e.push(a)},this),this.setProducts(e);var f=a.SwiftypeResults.info.page;this.set("numberOfPages",f.num_pages),this.set("totalNumberOfResults",f.total_result_count),this.trigger("data-fetched")},getFilters:function(){return this.get("filters")},getNumberOfResults:function(){return this.get("totalNumberOfResults")},getCurrentPage:function(){return this.get("page")},getNumberPerPage:function(){return this.get("numRes")},getNumberOfPages:function(){var a=parseInt(this.getNumberOfResults(),10),b=parseInt(this.getNumberPerPage(),10);return Math.ceil(a/b)},getProducts:function(){return this.get("products")},setCurrentPage:function(a){this.set("page",a)},setProducts:function(a){this.getProducts().setProducts(a)}}),k.View=d.View.extend({namespace:"sdm-brand-details-view",config:{selectors:{category_field:"[name=CategoryID]",brandName_field:"[name=Brands]",form:"[data-md-brnd-form]",header_container:"[data-md-brnd-products-header]",filter_container:"[data-md-brnd-products-filter]",products_container:"[data-md-brnd-products-list]",footer_container:"[data-md-brnd-products-pagination]"},templates:{header:"[data-widget-search-result-header-template]",loading:"[data-md-brnd-loading-template]"}},el:"[data-module='brand-details']",initialize:function(){var a=this.$(this.config.selectors.form);if(a.length>0){var d=this.$(this.config.selectors.category_field).val(),e=a.attr("action"),f=this.$(this.config.selectors.brandName_field).val();this.model=new k.Model({categoryId:d},{urlRoot:e,brands:f}),this.paginationModel=new i,this.paginationView=new j({model:this.paginationModel}),this.productGrid=new k.ProductGrid({products:this.model.getProducts()}),this.listenToOnce(this.model,"data-fetched",this.render),this.listenTo(this.model,"fetch-start",this.onFectchStart),c(window).on("becometowide."+this.namespace,b(function(){this.switchModeToDesktop()}).bind(this)),c(window).on("becometonarrow."+this.namespace,b(function(){this.switchModeToMobile()}).bind(this))}},switchModeToDesktop:function(){this.$(this.config.selectors.products_container).removeAttr("style")},switchModeToMobile:function(){this.$(this.config.selectors.products_container).removeAttr("style")},render:function(){this.setupPagination(),this.renderHeader(),this.renderFooter();var a=this.$(this.config.selectors.filter_container);this.model.getFilters().each(function(b){var c=b.renderView();c&&(a.append(c.$el),c.reinitializeScroller())},this),this.renderProductGrid(),this.listenTo(this.model,"data-fetched",this.updateView)},renderHeader:function(){var a=this.$(this.config.selectors.header_container),c=b.template(this.$(this.config.templates.header).html()),d=c({total_result_count:this.model.getNumberOfResults(),current_page:this.model.getCurrentPage(),per_page:this.model.getNumberPerPage()});a.html(d)},renderFooter:function(){this.$(this.config.selectors.footer_container).html(this.paginationView.$el)},renderProductGrid:function(){var a=this.$(this.config.selectors.products_container),b=this.productGrid.render().$el;a.html(b);var c=b.height();TweenLite.to(a,.5,{"min-height":c})},onFectchStart:function(){this.$(this.config.selectors.products_container).html("");var a=b.template(c(this.config.templates.loading).html())();this.$(this.config.selectors.header_container).html(a)},setupPagination:function(){this.paginationModel.setNumberOfPages(this.model.getNumberOfPages()),this.paginationModel.setCurrentPage(this.model.getCurrentPage()),this.paginationModel.onChangeCurrentPage(this.onPageChange,this)},onPageChange:function(){this.scrollTop(),this.model.setCurrentPage(this.paginationModel.getCurrentPage())},scrollTop:function(){var a=this.$(this.config.selectors.header_container).offset().top-(SDM.Util.getScrollOffset()+25);TweenLite.to(c("body, html"),.5,{scrollTop:a})},updateView:function(){this.renderHeader(),this.renderProductGrid(),this.setupPagination(),this.model.getFilters().trigger("data-fetched")}}),k.Products=d.Collection.extend({setProducts:function(a){this.set(a)}}),k.ProductGrid=d.View.extend({config:{analytics_event_label:"category"},initialize:function(a){this.products=a.products},render:function(){var a=b.template(c("[data-widget-product-grid-template]").html()),d=a({products:this.products.toJSON(),analytics_event_label:this.config.analytics_event_label});return this.setElement(d),this}}),k.FilterModules=d.Collection.extend({model:k.FilterModule,initialize:function(){this.on("filters-updated",this.onFiltersUpdated),this.on("data-fetched",this.updateView)},onFiltersUpdated:function(){this.disableFilters()},disableFilters:function(){this.each(function(a){a.trigger("disable-view")})},updateView:function(){this.each(function(a){a.trigger("update-view")})},addFilter:function(a,b,c){var d=this.findFilterModuleByType(a);if(d)d.setName(b),d.addOptions(c);else{var e=new k.FilterModule({type:a,name:b});e.addOptions(c),this.add(e)}},findFilterModuleByType:function(a){return this.find(function(b){return b.getType()===a},this)}}),k.FilterModule=d.Model.extend({defaults:{type:"",name:"",options:null},config:{brand_filter:"BR"},initialize:function(){if(this.set("options",new k.FilterModule.FilterOptions),this.getType()!==this.config.brand_filter){this.view=new k.FilterModuleView({model:this});var a=this.getOptions();this.updateComparator(),this.listenTo(a,"selection-updated",this.triggerReFetch)}},updateComparator:function(){this.get("type")===this.config.brand_filter&&this.getOptions().setComparatorToSortByAlphabet()},triggerReFetch:function(){this.trigger("filters-updated")},addOptions:function(a){this.get("options").set(a)},getType:function(){return this.get("type")},getSelectedOptions:function(){return this.get("options").getSelectedOptions()},getOptions:function(){return this.get("options")},getCount:function(){return this.getOptions().getCount()},renderView:function(){if(this.view)return this.view.render()},setName:function(a){this.get("name")!==a&&this.set("name",a)},clearAll:function(){this.getOptions().clearAll()},selectAll:function(){this.getOptions().selectAll()}}),k.FilterModuleView=d.View.extend({config:{selectors:{checkbox_container:"[data-wg-pf-cbl]",loading_continer:"[data-wg-pf-loading-container]"},template:"[data-widget-product-filters-generic-template]",special_templates:{BR:"[data-widget-product-filters-brand-template]"}},events:{"click [data-wg-pf-filter-clear-all-button]":"clearAll","click [data-wg-pf-filter-select-all-button]":"selectAll","click [data-wg-pf-alphabet-tab]":"scrollTo"},initialize:function(){this.listenTo(this.model,"disable-view",this.showLoading),this.listenTo(this.model,"update-view",this.update)},render:function(){var a=this.getTemplate(),b="",c={},d=this.model.attributes;return d.count=this.model.getCount(),b=a(d),this.setElement(b),this.cbl=new h({$container:this.$(this.config.selectors.checkbox_container)}),c=this.model.getOptions(),c.each(function(a){this.cbl.addItem(a.renderView().$el)},this),this},getTemplate:function(){var a=this.model.getType(),d=this.config.special_templates[a];return d=d||this.config.template,b.template(c(d).html())},update:function(){this.cbl.emptyList(),this.model.getOptions().each(function(a){this.cbl.addItem(a.renderView().$el)},this),this.reinitializeScroller(),this.hideLoading()},showLoading:function(){this.$(this.config.selectors.loading_continer).show()},hideLoading:function(){this.$(this.config.selectors.loading_continer).hide()},reinitializeScroller:function(){this.cbl.reinitializeScroller()},clearAll:function(a){a.preventDefault(),this.model.clearAll()},selectAll:function(a){a.preventDefault(),this.model.selectAll()},scrollTo:function(a){a.preventDefault();var b=c(a.target),d=b.data("wg-pf-alphabet-tab");this.$(".wg-pf-alphabet-tab-active").removeClass("wg-pf-alphabet-tab-active"),b.addClass("wg-pf-alphabet-tab-active");var e=this.$("[data-wg-pf-item-alphabet-group="+d+"]").first(),f=e.data("wg-clbl-item");this.cbl.scrollTo(f)}}),k.FilterModule.FilterOption=d.Model.extend({defaults:{id:"",value:"",name:"",label:"",type:"checkbox",total_results:0,order:0,first_letter:"",letter_group:""},letter_groups:{"a-c":["a","b","c"],"d-k":["d","e","f","g","h","i","j","k"],"l-p":["l","m","n","o","p"],"q-z":["q","r","s","t","u","v","w","x","y","z"]},initialize:function(){this.view=new k.FilterModule.FilterOptionView({model:this})},getValue:function(){return this.get("value")},isSelected:function(){return this.get("selected")},setValues:function(a,c,d,e,f,g){b.isNull(e)||this.set({selected:e},{silent:!0}),b.isNull(a)||this.set({type:a},{silent:!0}),b.isNull(g)&&(g=c),d=parseInt(d,10);var h=this.stripSpecialChars(c),i=h.charAt(0).toLowerCase();this.set({id:h,name:h,value:g,label:c+" ("+d+")",order:f,total_results:d,first_letter:i},{silent:!0}),this.setLetterGroup()},setLetterGroup:function(){b.each(this.letter_groups,function(a,c){b.find(a,function(a){return a===this.get("first_letter")},this)&&this.set({letter_group:c},{silent:!1})},this)},setSelected:function(a,b){this.set({selected:a},b)},stripSpecialChars:function(a){return a=a.replace(/[^\w\s]/gi,""),a=a.replace(/ /g,"_")},renderView:function(){return this.view.render()}}),k.FilterModule.FilterOptionView=d.View.extend({config:{selectors:{input:"[data-wg-pf-input]"}},initialize:function(){this.template=b.template(c("[data-wg-pf-filter-list-item-template]").html(),{evaluate:/\(\((.+?)\)\)/g,interpolate:/\(\(=(.+?)\)\)/g,escape:/\(\(-(.+?)\)\)/g})},events:{"change [data-wg-pf-input]":"toggleSelected"},render:function(){this.setElement(this.template(this.model.attributes));var a=this.model.isSelected();return this.$(this.config.selectors.input).prop("checked",a),this},toggleSelected:function(){var a=this.$(this.config.selectors.input),b=a.prop("checked");this.model.setSelected(b,{silent:!1})}}),k.FilterModule.FilterOptions=d.Collection.extend({model:k.FilterModule.FilterOption,comparator:"order",initialize:function(){this.on("change:selected",this.selectionUpdated)},selectionUpdated:function(){this.trigger("selection-updated")},getSelectedOptions:function(){return this.where({selected:!0,type:"checkbox"})},getCount:function(){return this.length},setComparatorToSortByAlphabet:function(){this.comparator="first_letter",this.sort()},clearAll:function(){this.each(function(a){a.setSelected(!1,{silent:!0})},this),this.trigger("selection-updated")},selectAll:function(){this.each(function(a){a.setSelected(!0,{silent:!0})},this),this.trigger("selection-updated")}})}.call(this),function(a){var b=this.NR||(this.NR={}),c=b.resolve("SDM.Core.Components"),d=b.resolve("SDM.Core.Modules"),e=d.CustomProductList||(d.CustomProductList={}),f={brands:"BR:",categories:"CT:"};e.Controller=function(a){this.config={View:new e.View({el:a,model:new e.ViewModel})}},e.Props=a.Model.extend({defaults:{products:e.Products,brands:e.Brands,categories:e.Categories}}),e.State=a.Model.extend({defaults:{products:[],brands:[],categories:[]}}),e.Filters=a.Model.extend({defaults:{brands:[],categories:[]},toggleFilter:function(a,b){if(!_.isEmpty(a)&&!_.isEmpty(b)){var c=_.invert(f)[a],d=this.get(c);_.indexOf(d,b)>=0?this.removeFilter(c,b):this.addFilter(c,b)}},addFilter:function(a,b){if(!_.isEmpty(a)&&!_.isEmpty(b)){var c=this.get(a);_.indexOf(c,b)>0||this.set(a,c.concat([b]))}},removeFilter:function(a,b){if(!_.isEmpty(a)&&!_.isEmpty(b)){var c=this.get(a),d=_.indexOf(c,b);d<0||this.set(a,c.slice(0,d).concat(c.slice(d+1)))}}}),e.ViewModel=a.Model.extend({defaults:{props:new e.Props,state:new e.State,filters:new e.Filters,pagination:new c.PaginationModel,resultsPerPage:9},initialize:function(){this.props=this.get("props"),this.state=this.get("state"),this.filters=this.get("filters"),this.pagination=this.get("pagination"),this.initBrands(this.props.get("brands")),this.initCategories(this.props.get("categories")),this.filters.on("change",_.debounce(function(){this.applyFilters()},300),this),this.pagination.onChangeCurrentPage(_.debounce(function(){this.applyFilters()},300),this),this.pagination.setCurrentPage(1)},initBrands:function(a){this.state.set("brands",this.formatBrands(a)),this.filters.set("brands",_.map(a,function(a){return a.Name}))},initCategories:function(a){this.state.set("categories",this.formatCategories(a)),this.filters.set("categories",_.map(a,function(a){return a.Name}))},formatBrands:function(a){if(_.isEmpty(a))return[];var b=_.clone(a).sort(function(a,b){return a.Name b.Name?1:0});return _.groupBy(b,function(a){return a.Name.charAt(0).toLowerCase()})},formatCategories:function(a){return _.isEmpty(a)?[]:_.clone(a).sort(function(a,b){return a.Name b.Name?1:0})},applyFilters:function(){var a=this.props.get("products"),b=this.filters.get("brands"),c=this.filterProductsByBrands(a,b),d=this.filters.get("categories");c=this.filterProductsByCategories(c,d);var e=this.get("resultsPerPage");this.updatePaginationPagesByProductList(c,e);var f=this.pagination.getCurrentPage();c=this.filterProductsByPageNumber(c,f,e),this.state.set("products",c),this.trigger("products:updated")},filterProductsByBrands:function(a,b){return _.isEmpty(a)?[]:_.filter(a,function(a){return _.some(b,function(b){return a.brand===b})})},filterProductsByCategories:function(a,b){return _.isEmpty(a)?[]:_.filter(a,function(a){return _.some(b,function(b){return _.some(a.categories,function(a){return a===b})})})},filterProductsByPageNumber:function(a,b,c){if(_.isEmpty(a))return[];if(!_.isNumber(b)||b<0)throw new Error("Page Number cannot be invalid.");if(!_.isNumber(c)||c<0)throw new Error("Results Per Page cannot be invalid.");var d=(b-1)*c;return a.slice(d,d+c)},updatePaginationPagesByProductList:function(a,b){if(!_.isArray(a))throw new Error("Products cannot be invalid.");if(!_.isNumber(b)||b<0)throw new Error("Results Per Page cannot be invalid.");var c=Math.ceil(a.length/b);this.pagination.setNumberOfPages(c),this.pagination.getCurrentPage()>c&&this.pagination.setCurrentPage(1)}}),e.View=a.View.extend({initialize:function(a){var b={srhtype:"products",event_label:"custom-product-list",selectors:{header_container:"[data-md-cpl-header-container]",brands_container:"[data-md-cpl-brands-container]",categories_container:"[data-md-cpl-categories-container]",products_container:"[data-md-cpl-products-container]",footer_container:"[data-md-cpl-footer-container]",checkbox:"[data-srh-checkbox]"},attributes:{categories_filter_label:"md-cpl-categories-filter-label",filter_type:"srh-flt-type",goto_page:"goto-page",checkbox:"srh-checkbox"},classes:{filters_container_collapsed:"flt-collapsed",checkbox_checked:"flt-lst-checked"},templates:{header:_.template($("#SrhTemplHeader").html()),brand_filters:_.template($("#SrhTemplBrandFlt").html()),generic_filters:_.template($("#SrhTemplChbx").html()),products:_.template($("#SrhTemplContProducts").html()),footer:_.template($("#SrhTemplFooter").html())}};this.options=$.extend(!0,b,a||{}),this.$header_container=$(this.options.selectors.header_container),this.$brands_container=$(this.options.selectors.brands_container),this.$categories_container=$(this.options.selectors.categories_container),this.$products_container=$(this.options.selectors.products_container),this.$footer_container=$(this.options.selectors.footer_container),this.props=this.model.get("props"),this.state=this.model.get("state"),this.filters=this.model.get("filters"),this.pagination=this.model.get("pagination"),this.listenTo(this.model,"products:updated",this.render),this.initBrandFilters(),this.initCategoryFilters(),this.render()},events:{"click [data-goto-page]":"clickGoToPage","click [data-srh-checkbox]":"toggleFilterItem","click [data-srh-title]":"toggleFilterContainer","click [data-srh-clear-all]":"clickClearAll","click [data-srh-select-all]":"clickSelectAll"},render:function(){var a=this.state.get("products"),b=this.model.filterProductsByCategories(this.model.filterProductsByBrands(this.props.get("products"),this.filters.get("brands")),this.filters.get("categories")),c={srhtype:this.options.srhtype,current_page:this.pagination.getCurrentPage(),num_pages:this.pagination.getNumberOfPages(),per_page:this.model.get("resultsPerPage"),total_result_count:b.length,results:a,event_label:this.options.event_label};this.$header_container.html(this.options.templates.header({templData:c})),this.$products_container.html(this.options.templates.products({templData:c})),this.$footer_container.html(this.options.templates.footer({templData:c}))},initBrandFilters:function(){var a=this.state.get("brands"),b={groupedBrands:a,numBrands:a.length};this.$brands_container.html(this.options.templates.brand_filters({templData:b})),this.BrandsFilterComponent=new c.CollapsibleButtonList({$container:this.$brands_container})},initCategoryFilters:function(){var a=this.state.get("categories"),b={filterByName:this.$categories_container.data(this.options.attributes.categories_filter_label),prefix:f.categories,results:a};this.$categories_container.html(this.options.templates.generic_filters({specTempData:b})),this.CategoriesFilterComponent=new c.CollapsibleButtonList({$container:this.$categories_container})},clickGoToPage:function(a){a.preventDefault();var b=$(a.currentTarget).data(this.options.attributes.goto_page);_.isNumber(b)&&(this.pagination.setCurrentPage(b),this.scrollToTop())},toggleFilterItem:function(a){a.preventDefault();var b=$(a.currentTarget),c=b.data(this.options.attributes.filter_type),d=b.data(this.options.attributes.checkbox);this.filters.toggleFilter(c,d),b.toggleClass(this.options.classes.checkbox_checked)},toggleFilterContainer:function(a){$(a.currentTarget).parent().toggleClass(this.options.classes.filters_container_collapsed)},clickClearAll:function(a){a.preventDefault();var b=$(a.target);this.modifyAllFilters($(a.target),_.bind(this.filters.removeFilter,this.filters)),b.parent().find(this.options.selectors.checkbox).removeClass(this.options.classes.checkbox_checked)},clickSelectAll:function(a){a.preventDefault();var b=$(a.target);this.modifyAllFilters(b,_.bind(this.filters.addFilter,this.filters)),b.parent().find(this.options.selectors.checkbox).addClass(this.options.classes.checkbox_checked)},modifyAllFilters:function(a,b){var c=a.data(this.options.attributes.filter_type),d=_.invert(f)[c],e=_.pluck(this.props.get(d),"Name");_.each(e,function(a){b(d,a)})},scrollToTop:function(){var a=this.$el.offset().top-50;document.body.scrollTop-1&&(b.preventDefault(),p.navigate(c.substr(c.indexOf("locations"))),i.scrollTo$ElementAsync(a,this.config.scroll_duration_ms))},this)),p.on("route:locations",function(b){if(b&&c.indexOf(n,b)>-1)this._renderListing(b);else{if(b)return void p.navigate("locations",{trigger:!0});this._renderListing((m.val()||"").toLowerCase())}i.scrollTo$ElementAsync(a,this.config.scroll_duration_ms)},this),p.on("route:default",function(){this._renderListing((m.val()||"").toLowerCase())},this),d.history.start({pushState:!0,root:i.getShortLanguageCode()+f.router_root})):this._renderListing((m.val()||"").toLowerCase())},k.prototype._renderListing=function(a){var d=this.stores_by_city_by_province_key[a]||[],e=c.keys(d).sort();b(this.config.selectors.list_container,this.$el).html(this.listing_template({cities:e,stores_by_city:d,num_total_stores:Array.prototype.concat.apply([],c.values(d)).length,language_code:i.getShortLanguageCode()}))}}(this),function(a,b){"use strict";var c=b(a),d=NR.resolve("SDM.Util"),e=NR.resolve("SDM.Core.Modules"),f=NR.resolve("SDM.Core.Components.VideoPanelDeeplink"),g=a.SDM||(a.SDM={}),h=g.GlobalTileGridData||(g.GlobalTileGridData={}),i=e.GlobalTileGrid=function(a,c){h.GlobalTiles||console.error(new Error("Missing GlobalTileGridData")),this.tileData=h.GlobalTiles.shift(),this.tileRow=h.InitialLoadRowCount.shift(),this.tileTemplateId=h.TileTemplateIds.shift(),this.isNavIncluded="True"===h.IsNavIncluded.shift(),c=c||{};var d={$el:a,tiles_per_load_desktop:3,tiles_per_load_tablet:2,tiles_per_load_mobile:3,tiles:[],isLastWindowDesktop:!1,selectors:{tiles_template:this.tileTemplateId,tiles_container:"[data-tiles-container]",load_more_button:"[data-load-more-button]"}},e=b.extend(!0,{},d,c);this._init(e)};i.prototype._init=function(a){this.config=a,this.template=_.template(b(a.selectors.tiles_template).html()),this.videoPanels=_.reduce(_.filter(this.tileData,function(a){return"video"===a.Type}),function(a,b){return a[b.ID]=b,a},{}),c.on("becometonarrow becometowide becometosmalldesktopwide becometoextrawide",{config:a},_.bind(this._resetGrid,this)),b(".wg-gt__tile-video-modal-popup, .wg-gt__tile-video-modal-close-button",this.config.$el).click(_.bind(this._onModalClick,this)),this.config.$el.on("click",".wg-gt__tile-video-detail-play",_.bind(function(a){var c=b(a.target).closest(".wg-gt__tile-video-detail"),d=c.data("wg-vp-video-player-id");if(history.pushState){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?v="+encodeURIComponent(d);window.history.pushState({path:e},"",e)}this._showVideo(d)},this)),this.config.$el.on("keydown",".wg-gt__tile-video-detail-play",_.bind(function(a){if(13===a.keyCode){var c=b(a.target).closest(".wg-gt__tile-video-detail"),d=c.data("wg-vp-video-player-id");if(history.pushState){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?v="+encodeURIComponent(d);window.history.pushState({path:e},"",e)}this._showVideo(d)}},this)),this.isNavIncluded&&this.config.$el.on("click",".md-gtg__tile-list-hamburger",_.bind(function(){this.config.$el.find(".md-gtg__tile-list-hamburger").toggleClass("md-gtg__tile-list-hamburger--active")},this)),window.onpopstate=_.bind(function(){var a=new URLSearchParams(window.location.search),b=a.get("v");b?this._showVideo(b):this.currentVideoPanel&&(this.currentVideoPanel._hide(!0),this.currentVideoPanel=null)},this);var d=new URLSearchParams(window.location.search),e=d.get("v");e&&this._showVideo(e)},i.prototype._resetGrid=function(){var a=d.isWindowSmallDesktopWide()||d.isWindowExtraWide();if(!a||!this.config.isLastWindowDesktop){this.config.isLastWindowDesktop=a;var c=d.isWindowNarrow();this.config.$el.find(this.config.selectors.tiles_container).empty();var e=0;e=c?this.tileRow*this.config.tiles_per_load_mobile:d.isWindowWide()?this.tileRow*this.config.tiles_per_load_tablet:this.tileRow*this.config.tiles_per_load_desktop;var f=this.isNavIncluded&&a?1:0;this.pagedTiles=_.reduce(this.tileData,function(a,b){if(c&&b.HideMobile)return a;var d=!c&&b.DoubleTile?2:1;return f+=d,f>e&&(f=d,a.push([])),a[a.length-1].push(b),a},[[]]);var g=0;0===this.tileRow?g=this.tileData.length:this.config.$el.find(this.config.selectors.load_more_button).off("click").click(function(){this._renderPage(g+=1)}.bind(this)),b(document.body).css({position:"",top:"",width:""}),window.scrollTo(0,this.modalScrollY),this._renderPage(g),this.isNavIncluded&&(d.isWindowNarrow()||d.isWindowWide()?b("#Body").css("padding-top",b(".md-gtg__tile-list-links")[0].clientHeight):b("#Body").css("padding-top",""))}},i.prototype._renderPage=function(a){for(var b=[],c=0;c<=a;c++)b=b.concat(this.pagedTiles[c]);this.config.$el.find(this.config.selectors.load_more_button).toggleClass("md-gtg__load-more-button--hidden",!this.pagedTiles[a+1]),this.config.$el.find(this.config.selectors.tiles_container).html(this.template({tiles:b}))},i.prototype._showVideo=function(a){if(a&&this.videoPanels[a]){ this.currentVideoPanel=new f({$modalContainer:b(document).find("[data-wg-gt-tile-video-modal]"),$container:this.videoPanels[a],$closeButtonContainer:b(document).find("[data-wg-gt-tile-video-modal-close-button]")});var c=document.querySelector(".wg-gt__tile-video-modal-container");this.modalScrollY=window.scrollY,c.velocity({top:"0%"},500,[210,19]),setTimeout(function(){b(document.body).css("top","-"+this.modalScrollY+"px"),b(document.body).css("position","fixed"),b(document.body).css("width","100%")},0),setTimeout(function(){var a=c.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], [contenteditable]'),b=a[0],d=a[a.length-1];c.addEventListener("keydown",function(a){("Tab"===a.key||9===a.keyCode)&&(a.shiftKey?document.activeElement===b&&(d.focus(),a.preventDefault()):document.activeElement===d&&(b.focus(),a.preventDefault()))}),b.focus()},1e3)}},i.prototype._onModalClick=function(a){a.stopPropagation(),a.preventDefault(),this.currentVideoPanel._hide(!1),this.currentVideoPanel=null}}(this,jQuery),function(a,b){var c=NR.resolve("SDM.Core.Modules"),d=NR.resolve("SDM.ArticleContentGridData"),e=NR.resolve("SDM.Core.Components.VideoPanel"),f=NR.resolve("SDM.Core.Components"),g=f.SliderCarousel,h=c.ArticleContentGrid=function(a,c){c=c||{};for(var e={$el:a},f=d.RelatedArticlesJSON,g=d.RelatedArticlesUrlsJSON,h=0;h -1?a.config.selectedFilters.splice(c,1):a.config.selectedFilters.push(b(this).val())}a._getStores()}),b(".md-fsf__filter-clear-button").on("click",function(){b(".md-fsf__filters-container").addClass("md-fsf__filters-container--disabled"),b(".wg-fsfb__search-form").addClass("wg-fsfb__search-form--disabled"),b(".md-fsf__filter-checkbox").prop("checked",!1),a.config.selectedFilters=[],a.config.walkinsFilter=!1,a._getStores()})},n.prototype._initPopUps=function(){var a=b(this.config.$el.find(this.config.selectors.storeNotificationPopUp));this.config.storeNotificationPopUp=new f.PopUp(a);var c=b(this.config.$el.find(this.config.selectors.storeReminderPopUp));this.config.storeReminderPopUp=new f.PopUp(c),this.config.elements.$storeNotificationBack=this.config.$el.find(this.config.selectors.storeNotificationButtonBack),this.config.elements.$storeNotificationBack.on("click",_.bind(this._onStoreNotificationBack,this))},n.prototype._queryMap=function(a){this.geocoder.geocode({address:a},_.bind(this._geocoderCallback,this))},n.prototype._geocoderCallback=function(c,d){d===a.google.maps.GeocoderStatus.OK?(this.config.$el.find(this.config.selectors.searchError).css("display","none"),this.config.$el.find(this.config.selectors.searchInput).attr("aria-invalid",!1),this.config.$el.find(this.config.selectors.storeListSearchError).hide(),b("#md-fsf__filters-button").prop("disabled",!1),this.query_location=c[0].geometry.location,this.map.setCenter(this.query_location),this._getStores()):(b("#md-fsf__store-list-error-msg--pre-search").hide(),b("#md-fsf__store-list-error-msg").show(),this.config.$el.find(this.config.selectors.searchError).css("display","block"),this.config.$el.find(this.config.selectors.searchInput).attr("aria-invalid",!0),this.config.$el.find(this.config.selectors.storeListSearchError).show(),b("#md-fsf__filters-button").prop("disabled",!0),b(".md-fsf__filters-container").removeClass("md-fsf__filters-container--disabled"),b(".wg-fsfb__search-form").removeClass("wg-fsfb__search-form--disabled"),this._renderStoreList([]))},n.prototype._getStores=function(){google.maps.event.removeListener(this.zoomChangedListener),google.maps.event.removeListener(this.dragEndListener),b(".md-fsf__filters-container").addClass("md-fsf__filters-container--disabled"),b(".wg-fsfb__search-form").addClass("wg-fsfb__search-form--disabled"),this._clearAllMarkers(),this.config.$el.find(this.config.selectors.finderLoading).addClass(this.config.classes.loadingVisible);var a={fluShotTypes:this.config.selectedFilters.join(","),lang:g.getShortLanguageCode(),lat:this.query_location.lat(),lng:this.query_location.lng(),minLat:this.map.getBounds().getSouthWest().lat(),minLng:this.map.getBounds().getSouthWest().lng(),maxLat:this.map.getBounds().getNorthEast().lat(),maxLng:this.map.getBounds().getNorthEast().lng(),walkin:this.config.walkinsFilter};b.ajax({method:"GET",url:"/sdmapi/store/GetFluShotStores",data:a}).done(_.bind(function(a){if(a){this.config.storeHoursPopUps={},this.config.$el.find(this.config.selectors.finderLoading).removeClass(this.config.classes.loadingVisible),this._renderStoreList(a),this._addMarkerToMap(a),this._initStorePopUp(a);var c=this;this.dragEndListener=google.maps.event.addListenerOnce(this.map,"dragend",function(){c.dragEndListener=google.maps.event.addListenerOnce(c.map,"idle",function(){c._getStores()})}),this.zoomChangedListener=google.maps.event.addListenerOnce(this.map,"zoom_changed",function(){c._getStores()}),b(".md-fsf__filters-container").removeClass("md-fsf__filters-container--disabled"),b(".wg-fsfb__search-form").removeClass("wg-fsfb__search-form--disabled")}},this)).fail(function(a){console.log(a)})},n.prototype._addMarkerToMap=function(a){if(0!==a.length){this.bounds=new google.maps.LatLngBounds;for(var c=_.template(b(this.config.templates.storeInfo).html()),d=0;d 0?e.storeUrl="https://stores.shoppersdrugmart.ca/"+g.getShortLanguageCode()+"/store/"+e.StoreID:e.storeUrl="https://stores.pharmaprix.ca/"+g.getShortLanguageCode()+"/store/"+e.StoreID;var f=d+1,h="",i={};e.VaccineAvailable?(h="/static/core/images/covid-shot-available-pin.png",i={text:String(f),fontSize:"16px",fontWeight:"bold",color:"white"}):(h="/static/core/images/covid-shot-unavailable-pin.png",i={text:String(f),fontSize:"16px",fontWeight:"bold",color:"black"});var l=k+" "+(d+1),m=new google.maps.Marker({position:{lat:e.Latitude,lng:e.Longitude},map:this.map,label:i,icon:{url:h,scaledSize:new google.maps.Size(24.5,35.5),labelOrigin:new google.maps.Point(12,15)},title:l});this.markers.push(m);var n=new google.maps.InfoWindow({content:c({store:e,storeNotificationStores:this.config.storeNotificationStores,notifyMeIconDisplayPerProvince:j})});m.addListener("click",_.bind(this._openInfoWindow,this,n,this.map,m))}}},n.prototype._openInfoWindow=function(a,b,c){this.lastInfoWindow&&this.lastInfoWindow.close(),a.open(b,c),this.lastInfoWindow=a,google.maps.event.addListener(a,"domready",_.bind(this._initInfoWindow,this))},n.prototype._initInfoWindow=function(){var a=b(this.config.$el.find(this.config.selectors.storeInfoStoreHours)),c=b(a.closest(this.config.selectors.storeInfoStore));this.config.tempStoreId=c.data(this.config.data.storeInfoStoreId);var d=c.find(this.config.selectors.storeInfoStoreNotification),e=c.find(this.config.selectors.storeInfoStoreReminder);this._updateStoreInfoStoreNotificationButton(),d.unbind("click").on("click",_.bind(this._renderStoreNotification,this)),e.unbind("click").on("click",_.bind(this._renderStoreReminder,this,this.config.tempStoreId))},n.prototype._clearAllMarkers=function(){for(var a=0;a 0){this.config.$el.find(this.config.selectors.searchError).css("display","none"),this.config.$el.find(this.config.selectors.searchInput).attr("aria-invalid",!1),this.config.$el.find(this.config.selectors.storeListSearchError).hide(),b("#md-fsf__filters-button").prop("disabled",!1);for(var c=0;a.length>c;c++)window.location.host.search("shoppersdrugmart")>0?a[c].storeUrl="https://stores.shoppersdrugmart.ca/"+g.getShortLanguageCode()+"/store/"+a[c].StoreID:a[c].storeUrl="https://stores.pharmaprix.ca/"+g.getShortLanguageCode()+"/store/"+a[c].StoreID;this.config.$el.find(this.config.selectors.storeList).removeClass(this.config.classes.storeListCollapse);var d=_.template(b(this.config.templates.storeList).html());this.config.storeListData=a;var e={storeList:a,notifyMeIconDisplayPerProvince:j,storeNotificationStores:this.config.storeNotificationStores};this.config.$el.find(this.config.selectors.storeList).html(d(e)),this.config.$el.find(this.config.selectors.storeIconNotificationButton).on("click",_.bind(this._onStoreIconNotificationButtonClick,this)),this.config.$el.find(this.config.selectors.storeConsentFormButton).on("click",_.bind(this._onStoreConsentFormButtonClick,this)),this.config.$el.find(this.config.selectors.storeProvincialBookingButton).on("click",_.bind(this._onStoreprovincialBookingButtonClick,this))}else this.config.$el.find(this.config.selectors.storeList).addClass(this.config.classes.storeListCollapse),this.config.$el.find(this.config.selectors.searchError).css("display","block"),this.config.$el.find(this.config.selectors.searchInput).attr("aria-invalid",!0),this.config.$el.find(this.config.selectors.storeListSearchError).show(),b("#md-fsf__filters-button").prop("disabled",!0)},n.prototype._onStoreIconNotificationButtonClick=function(a){var c=b(b(a.currentTarget).closest(this.config.selectors.store));this.config.tempStoreId=c.data(this.config.data.storeId),this.config.selectedStoresArray.length<3&&-1===this.config.selectedStoresArray.indexOf(this.config.tempStoreId)&&(this.config.selectedStoresArray.push(this.config.tempStoreId),b(".md-fsf__store-icon-notification-item--pilot-notify-a").css("display","none"),b(".md-fsf__store-icon-notification-item--pilot-notify-b").css("display","flex"),b(a.currentTarget).addClass(this.config.classes.storeIconNotificationButtonEdit)),this._renderStoreNotification()},n.prototype._updateStoreInfoStoreNotificationButton=function(){var a=this.config.$el.find(this.config.selectors.storeInfoStore),b=a.data(this.config.data.storeInfoStoreId),c=a.find(this.config.selectors.storeInfoStoreNotification);this.config.storeNotificationStores[b]?c.addClass(this.config.classes.storeIconNotificationButtonEdit):c.removeClass(this.config.classes.storeIconNotificationButtonEdit)},n.prototype._renderStoreNotification=function(){var a=!1;delete this.config.storeNotificationStores[""],Object.keys(this.config.storeNotificationStores).length<3?this.config.storeNotificationStores[this.config.tempStoreId]=this.config.stores[this.config.tempStoreId]:this.config.storeNotificationStores[this.config.tempStoreId]||(a=!0),this.config.storeNotificationPopUp._showModal();var c=_.template(b(this.config.templates.storeNotification).html());this.config.storeNotificationStores[""]="",delete this.config.storeNotificationStores[""];var d={stores:this.config.storeNotificationStores,showStoreNotificationAddStoreError:a};this.config.$el.find(this.config.selectors.storeNotification).html(c(d)),this._initStoreNotification()},n.prototype._updateStoreNotificationButton=function(a){b(this.config.$el.find("[data-"+this.config.data.storeId+"="+a+"]")).find(this.config.selectors.storeIconNotificationButton).addClass(this.config.classes.storeIconNotificationButtonEdit),this._updateStoreInfoStoreNotificationButton()},n.prototype._getStoreListConsentForm=function(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=i[a[c].province];if(!d)continue;b[a[c].province]=d}return b},n.prototype._initStoreNotification=function(){this.config.elements.$storeNotification=this.config.$el.find(this.config.selectors.storeNotification),this.config.elements.$storeNotificationSteps=this.config.elements.$storeNotification.find("[data-"+this.config.data.storeNotificationStep+"]"),this.config.elements.$storeNotificationNext=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationButtonNext),this.config.elements.$storeNotificationSkip=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationButtonSkip),this.config.elements.$storeNotificationSubmit=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationButtonSubmit),this.config.elements.$storeNotificationShotTypeHigh=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationShotTypeHigh),this.config.elements.$storeNotificationShotTypeRegular=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationShotTypeRegular),this.config.elements.$storeNotificationEmailInput=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationEmailInput),this.config.elements.$storeNotificationSmsInput=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationSmsInput),this.config.elements.$storeNotificationSmsCheckbox=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationSmsCheckbox),this.config.elements.$storeNotificationEmailInputError=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationEmailInputError),this.config.elements.$storeNotificationSmsInputError=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationSmsInputError),this.config.elements.$storeNotificationEmailCheckbox=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationEmailCheckbox),this.config.elements.$storeNotificationEmailRadio=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationEmailRadio),this.config.elements.$storeNotificationSmsRadio=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationSmsRadio),this.config.elements.$storeNotificationEmailConfirmation=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationEmailConfirmation),this.config.elements.$storeNotificationSmsConfirmation=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationSmsConfirmation),this.config.elements.$storeNotificationRemove=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationStoreRemove),this.config.elements.$storeNotificationAddStore=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationAddStore),this.config.elements.$storeNotificationAddStoreError=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationAddStoreError),this.config.elements.$storeNotificationSubmitError=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationSubmitError),this.config.elements.$storeNotificationEditStore=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationEditStore),this.config.elements.$storeNotificationEmailEdit=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationEmailEdit),this.config.elements.$storeNotificationTypesEdit=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationTypesEdit),this.config.elements.$storeNotificationTypesEdit=this.config.elements.$storeNotification.find(this.config.selectors.storeNotificationTypesEdit),this.config.storeNotificationActiveStep=1,this.config.activeStep=0,this.config.elements.$storeNotificationBack.addClass(this.config.classes.storeNotificationButtonCollapse),this.config.elements.$storeNotificationNext.removeClass(this.config.classes.storeNotificationButtonCollapse);for(var a=1;a<=this.config.elements.$storeNotificationSteps.length;a++)this.config.elements.$storeNotificationStep=b(this.config.elements.$storeNotification.find("[data-"+this.config.data.storeNotificationStep+"="+a+"]")),1===a?this.config.elements.$storeNotificationStep.removeClass(this.config.classes.storeNotificationStepCollapse):this.config.elements.$storeNotificationStep.addClass(this.config.classes.storeNotificationStepCollapse);var c=this;document.querySelector("#email").addEventListener("change",function(){c.config.storeNotificationEmailChecked=this.checked,c.config.storeNotificationPhoneNumberChecked=!1,document.querySelector("#md-fsf__store-notification-email-checkbox-consent").classList.add("active"),document.querySelector("#md-fsf__store-notification-sms-checkbox-consent").classList.remove("active"),document.querySelector("[data-md-fsf-store-notification-sms-checkbox]").checked=!1,c.config.elements.$storeNotificationSmsInput.prop("disabled",!0),c.config.elements.$storeNotificationEmailInput.prop("disabled",!1),b("#md-fsf__store-notification-email-input-consent").show(),b("#md-fsf__store-notification-sms-input-consent").hide(),b("#md-fsf__store-notification-email-disclaimer").show(),b("#md-fsf__store-notification-sms-disclaimer").hide(),c._onDisplayStep3()}),document.querySelector("#sms").addEventListener("change",function(){c.config.storeNotificationPhoneNumberChecked=this.checked,c.config.storeNotificationEmailChecked=!1,document.querySelector("[data-md-fsf-store-notification-email-checkbox]").checked=!1,document.querySelector("#md-fsf__store-notification-email-checkbox-consent").classList.remove("active"),document.querySelector("#md-fsf__store-notification-sms-checkbox-consent").classList.add("active"),c.config.elements.$storeNotificationSmsInput.prop("disabled",!1),c.config.elements.$storeNotificationEmailInput.prop("disabled",!0),b("#md-fsf__store-notification-email-input-consent").hide(),b("#md-fsf__store-notification-sms-input-consent").show(),b("#md-fsf__store-notification-email-disclaimer").hide(),b("#md-fsf__store-notification-sms-disclaimer").show(),c._onDisplayStep3()}),document.querySelector("#shot-type-high").addEventListener("change",function(){c.config.storeNotificationFluShotTypeHigh=this.checked,c._onDisplayStep2()}),document.querySelector("#shot-type-regular").addEventListener("change",function(){c.config.storeNotificationFluShotTypeRegular=this.checked,c._onDisplayStep2()}),document.querySelector("#md-fsf__store-notification-shot-type-remove-button--high").addEventListener("click",function(){b("#md-fsf__store-notification-shot-type-confirmation--high").hide(),b("#md-fsf__store-notification-shot-type-remove-button--high").hide(),b("#md-fsf__store-notification-shot-type-remove-button--regular").hide(),c.config.storeNotificationFluShotTypeHigh=!1}),document.querySelector("#md-fsf__store-notification-shot-type-remove-button--regular").addEventListener("click",function(){b("#md-fsf__store-notification-shot-type-confirmation--regular").hide(),b("#md-fsf__store-notification-shot-type-remove-button--high").hide(),b("#md-fsf__store-notification-shot-type-remove-button--regular").hide(),c.config.storeNotificationFluShotTypeRegular=!1}),this.config.$el.find(".wg-pu__content-container").on("keydown",_.bind(this._onKeyDown,this)),this.config.elements.$storeNotificationNext.on("click",_.bind(this._onStoreNotificationNext,this)),this.config.elements.$storeNotificationSubmit.on("click",_.bind(this._onStoreNotificationSubmit,this)),this.config.elements.$storeNotificationRemove.on("click",_.bind(this._onStoreNotificationStoreRemove,this)),this.config.elements.$storeNotificationAddStore.on("click",_.bind(this.config.storeNotificationPopUp._hideModal,this.config.storeNotificationPopUp)),this.config.elements.$storeNotificationEditStore.on("click",_.bind(this._onStoreNotificationStoreEdit,this)),this.config.elements.$storeNotificationEmailEdit.on("click",_.bind(this._onStoreNotificationBack,this)),this.config.elements.$storeNotificationTypesEdit.on("click",_.bind(this._onStoreNotificationTypesEdit,this)),this._onDisplayStep1()},n.prototype._onStoreNotificationNext=function(a){if(this.config.storeNotificationActiveStep!==this.config.elements.$storeNotificationSteps.length){if(3===this.config.storeNotificationActiveStep){var b=/^(([abcdefg.hijklmnopqrstuvwxyz!#$%&'*/=?^_+-`{|}~0123456789]+))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(this.config.elements.$storeNotificationEmailRadio[0].checked){if(0===this.config.elements.$storeNotificationEmailInput[0].value.length||!b.test(this.config.elements.$storeNotificationEmailInput[0].value))return this.config.elements.$storeNotificationEmailInputError.show(),this.config.elements.$storeNotificationSmsInputError.hide(),void this.config.elements.$storeNotificationEmailInput.focus();this.config.storeNotificationEmail=this.config.elements.$storeNotificationEmailInput[0].value,this.config.storeNotificationEmailConsent=this.config.elements.$storeNotificationEmailCheckbox[0].checked,this.config.storeNotificationPhoneNumber="",this.config.storeNotificationSmsConsent=!1,this.config.storeNotificationEmailRadioChecked=!0, this.config.storeNotificationSmsRadioChecked=!1,this._notificationStepForward()}else{if(0===this.config.elements.$storeNotificationSmsInput[0].value.length||null===this.config.elements.$storeNotificationSmsInput[0].value.match(/^[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4}$/im))return this.config.elements.$storeNotificationEmailInputError.hide(),this.config.elements.$storeNotificationSmsInputError.show(),void this.config.elements.$storeNotificationSmsInput.focus();this.config.storeNotificationPhoneNumber=this.config.elements.$storeNotificationSmsInput[0].value,this.config.storeNotificationSmsConsent=this.config.elements.$storeNotificationSmsCheckbox[0].checked,this.config.storeNotificationEmail="",this.config.storeNotificationEmailConsent=!1,this.config.storeNotificationEmailRadioChecked=!1,this.config.storeNotificationSmsRadioChecked=!0,this._notificationStepForward()}}else this._notificationStepForward();1===this.config.storeNotificationActiveStep?this._onDisplayStep1():2===this.config.storeNotificationActiveStep?this._onDisplayStep2():3===this.config.storeNotificationActiveStep?this._onDisplayStep3():4===this.config.storeNotificationActiveStep&&this._onDisplayStep4(),a.preventDefault()}},n.prototype._onStoreNotificationBack=function(a){1!==this.config.storeNotificationActiveStep&&(b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).addClass(this.config.classes.storeNotificationStepCollapse),this.config.storeNotificationActiveStep--,b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).removeClass(this.config.classes.storeNotificationStepCollapse),1===this.config.storeNotificationActiveStep?this._onDisplayStep1():2===this.config.storeNotificationActiveStep?this._onDisplayStep2():3===this.config.storeNotificationActiveStep?this._onDisplayStep3():4===this.config.storeNotificationActiveStep&&this._onDisplayStep4(),a.preventDefault())},n.prototype._onStoreNotificationStoreEdit=function(){b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).addClass(this.config.classes.storeNotificationStepCollapse),this.config.storeNotificationActiveStep=1,b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).removeClass(this.config.classes.storeNotificationStepCollapse),this.config.activeStep=0,this._onDisplayStep1()},n.prototype._onStoreNotificationTypesEdit=function(){b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).addClass(this.config.classes.storeNotificationStepCollapse),this.config.storeNotificationActiveStep=2,b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).removeClass(this.config.classes.storeNotificationStepCollapse)},n.prototype._notificationStepForward=function(){b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).addClass(this.config.classes.storeNotificationStepCollapse),this.config.storeNotificationActiveStep++,b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).removeClass(this.config.classes.storeNotificationStepCollapse)},n.prototype._onDisplayStep1=function(){this.config.elements.$storeNotificationBack.addClass(this.config.classes.storeNotificationButtonCollapse),b(".md-fsf__store-notification-button--next").removeClass("md-fsf__store-notification-button--disabled"),b(".md-fsf__store-notification-button--next").prop("disabled",!1),Object.keys(this.config.storeNotificationStores).length>=3?(this.config.elements.$storeNotificationAddStore.hide(),this.config.elements.$storeNotificationAddStore.prop("disabled",!0)):(this.config.elements.$storeNotificationAddStore.show(),this.config.elements.$storeNotificationAddStore.prop("disabled",!1)),0===Object.keys(this.config.storeNotificationStores).length&&(this.config.elements.$storeNotificationNext[0].disabled=!0),1!==this.config.activeStep&&(this._focusFirstElement(),this.config.activeStep=1)},n.prototype._onDisplayStep2=function(){this.config.elements.$storeNotificationBack.removeClass(this.config.classes.storeNotificationButtonCollapse),this.config.elements.$storeNotificationAddStoreError.addClass(this.config.classes.storeNotificationAddStoreErrorCollapse),document.querySelector("[data-md-fsf-store-notification-type-high-checkbox]").checked=this.config.storeNotificationFluShotTypeHigh,document.querySelector("[data-md-fsf-store-notification-type-regular-checkbox]").checked=this.config.storeNotificationFluShotTypeRegular,this.config.storeNotificationFluShotTypeHigh||this.config.storeNotificationFluShotTypeRegular?(b(".md-fsf__store-notification-button--next").removeClass("md-fsf__store-notification-button--disabled"),b(".md-fsf__store-notification-button--next").prop("disabled",!1)):(b(".md-fsf__store-notification-button--next").addClass("md-fsf__store-notification-button--disabled"),b(".md-fsf__store-notification-button--next").prop("disabled",!0)),Object.size=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c};var a=Object.size(this.config.storeNotificationStores);b("#md-fsf__store-notification-stores-selected-count--step-2").html(a),2!==this.config.activeStep&&(this._focusFirstElement(),this.config.activeStep=2)},n.prototype._onDisplayStep3=function(){this.config.elements.$storeNotificationEmailInputError.hide(),this.config.elements.$storeNotificationSmsInputError.hide(),this.config.elements.$storeNotificationSmsRadio.checked=this.config.storeNotificationSmsRadioChecked,this.config.elements.$storeNotificationEmailRadio.checked=this.config.storeNotificationEmailRadioChecked,this.config.storeNotificationEmailRadioChecked?this.config.elements.$storeNotificationEmailInput[0].value=this.config.storeNotificationEmail:this.config.elements.$storeNotificationSmsInput[0].value=this.config.storeNotificationPhoneNumber,this.config.storeNotificationEmailConsent&&(this.config.elements.$storeNotificationEmailCheckbox[0].checked=!0),this.config.storeNotificationSmsConsent&&(this.config.elements.$storeNotificationSmsCheckbox[0].checked=!0),Object.size=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c};var a=Object.size(this.config.storeNotificationStores);b("#md-fsf__store-notification-stores-selected-count--step-3").html(a);var c=1;this.config.storeNotificationFluShotTypeHigh&&this.config.storeNotificationFluShotTypeRegular&&(c=2),b("#md-fsf__store-notification-selected-shot-count").html(c),3!==this.config.activeStep&&(this._focusFirstElement(),this.config.activeStep=3)},n.prototype._onDisplayStep4=function(){this.config.elements.$storeNotificationSubmitError.hide(),Object.size=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c},this.config.storeNotificationFluShotTypeHigh?b("#md-fsf__store-notification-shot-type-confirmation--high").show():(b("#md-fsf__store-notification-shot-type-confirmation--high").hide(),b("#md-fsf__store-notification-shot-type-confirmation--high").prop("disabled",!0)),this.config.storeNotificationFluShotTypeRegular?b("#md-fsf__store-notification-shot-type-confirmation--regular").show():(b("#md-fsf__store-notification-shot-type-confirmation--regular").hide(),b("#md-fsf__store-notification-shot-type-confirmation--regular").prop("disabled",!0)),this.config.storeNotificationFluShotTypeRegular&&this.config.storeNotificationFluShotTypeHigh?(b("#md-fsf__store-notification-shot-type-remove-button--high").show(),b("#md-fsf__store-notification-shot-type-remove-button--regular").show()):(b("#md-fsf__store-notification-shot-type-remove-button--high").hide(),b("#md-fsf__store-notification-shot-type-remove-button--regular").hide(),b("#md-fsf__store-notification-shot-type-remove-button--high").prop("disabled",!0),b("#md-fsf__store-notification-shot-type-remove-button--regular").prop("disabled",!0)),this.config.storeNotificationEmail?(b("#md-fsf__store-notification-email-confirmation-container").show(),b("#md-fsf__store-notification-sms-confirmation-container").hide(),this.config.elements.$storeNotificationEmailConfirmation.html(this.config.storeNotificationEmail)):(b("#md-fsf__store-notification-email-confirmation-container").hide(),b("#md-fsf__store-notification-sms-confirmation-container").show(),this.config.elements.$storeNotificationSmsConfirmation.html(this.config.storeNotificationPhoneNumber)),4!==this.config.activeStep&&(this._focusFirstElement(),this.config.activeStep=4)},n.prototype._onDisplayStep5=function(){this._focusFirstElement()},n.prototype._focusFirstElement=function(){var a=this.config.$el.find(".md-fsf__store-notification-step--"+this.config.storeNotificationActiveStep),b=a.find(this.config.focusableElements),c=a.find(b)[0];setTimeout(function(){c.focus()}.bind(this),600)},n.prototype._onKeyDown=function(){if("Tab"===event.key||9===event.keyCode){var a=this.config.$el.find(".md-fsf__store-notification-step--"+this.config.storeNotificationActiveStep),b=a.find(this.config.focusableElements);1!==this.config.storeNotificationActiveStep&&b.push(document.querySelector(".wg-pu__content-container").querySelector(".md-fsf__store-notification-button--back")),b.push(document.querySelector(".wg-pu__content-container").querySelector(".wg-pu__close-button"));var c=a.find(b)[0],d=b[b.length-1];event.shiftKey?document.activeElement===c&&(d.focus(),event.preventDefault()):document.activeElement===d&&(c.focus(),event.preventDefault())}},n.prototype._onStoreNotificationSubmit=function(){Object.size=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c},this.config.elements.$storeNotificationBack.addClass(this.config.classes.storeNotificationButtonCollapse);var a=b(this.config.$el.find(this.config.selectors.storeNotification)),c=b(a.find(this.config.selectors.storeNotificationButtonBack)),d=b(a.find(this.config.selectors.storeNotificationButtonSubmit)),e=b(this.config.$el.find(this.config.selectors.storeNotificationSubmitError)),f=a.find(this.config.selectors.storeNotificationEmailRadio),i=a.find(this.config.selectors.storeNotificationSmsRadio);e.hide(),a.find(this.config.selectors.storeNotificationLoading).addClass(this.config.classes.loadingVisible);var j=Object.keys(this.config.storeNotificationStores),k={SubscriberKey:l,Email:this.config.storeNotificationEmail,LangCode:g.getFullLanguageCode(),Phone:this.config.storeNotificationPhoneNumber,StoreA:j[0]?j[0]:"",StoreB:j[1]?j[1]:"",StoreC:j[2]?j[2]:"",EmailFluOptIn:f[0].checked,SmsFluOptIn:i[0].checked,EmailPromoOptIn:this.config.storeNotificationEmailConsent,SmsPromoOptIn:this.config.storeNotificationSmsConsent,FluShotRegular:this.config.storeNotificationFluShotTypeRegular,FluShotHighDose:this.config.storeNotificationFluShotTypeHigh};b.ajax({type:"POST",url:this.config.storeNotificationSubmitUrl,contentType:"application/json",data:JSON.stringify(k),headers:{__RequestVerificationToken:h}}).done(_.bind(function(f){if(a.find(this.config.selectors.storeNotificationLoading).removeClass(this.config.classes.loadingVisible),"OK"!==f.Status)return void e.show();f.Updated?(b("#md-fsf__store-notification-header-success").hide(),b("#md-fsf__store-notification-header-resubmission").show()):(b("#md-fsf__store-notification-header-success").show(),b("#md-fsf__store-notification-header-resubmission").hide()),b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).addClass(this.config.classes.storeNotificationStepCollapse),this.config.storeNotificationActiveStep+=1,b(this.config.$el.find("[data-"+this.config.data.storeNotificationStep+"="+this.config.storeNotificationActiveStep+"]")).removeClass(this.config.classes.storeNotificationStepCollapse),c.addClass(this.config.classes.storeNotificationButtonCollapse),d.addClass(this.config.classes.storeNotificationButtonCollapse),this.config.elements.$storeNotification.find("[data-md-fsf-store-notification-button-complete]").on("click",_.bind(this.config.storeNotificationPopUp._hideModal,this.config.storeNotificationPopUp)),this.config.storeNotificationStores={},this.config.selectedStoresArray=[],this.config.$el.find(this.config.selectors.storeIconNotificationButton).removeClass(this.config.classes.storeIconNotificationButtonEdit),this.config.storeNotificationEmail="",this.config.storeNotificationEmailConsent=!1,this.config.storeNotificationPhoneNumber="",this.config.storeNotificationSmsConsent=!1,this.config.storeNotificationFluShotTypeRegular=!1,this.config.storeNotificationFluShotTypeHigh=!1,b(".md-fsf__store-icon-notification-item--pilot-notify-a").css("display","flex"),b(".md-fsf__store-icon-notification-item--pilot-notify-b").css("display","none"),this._onDisplayStep5()},this))},n.prototype._onStoreNotificationStoreRemove=function(a){setTimeout(_.bind(function(){var c=b(this.config.$el.find(this.config.selectors.storeNotification)),d=b(a.currentTarget.closest(this.config.selectors.storeNotificationStore)),e=d.data(this.config.data.storeNotificationStoreId),f=c.find("[data-"+this.config.data.storeNotificationStoreId+"="+e+"]"),g=b(this.config.$el.find(this.config.selectors.storeNotificationAddStoreError));f.remove(),delete this.config.storeNotificationStores[e],g.addClass(this.config.classes.storeNotificationAddStoreErrorCollapse);var h=b(this.config.$el.find("[data-"+this.config.data.storeId+"="+e+"]")),i=h.find(this.config.selectors.storeIconNotificationButton),j=this.config.$el.find(this.config.selectors.storeInfoStore),k=j.data(this.config.data.storeInfoStoreId),l=j.find(this.config.selectors.storeInfoStoreNotification);i.removeClass(this.config.classes.storeIconNotificationButtonEdit),e===k&&l.removeClass(this.config.classes.storeIconNotificationButtonEdit),this.config.selectedStoresArray=this.config.selectedStoresArray.filter(function(a){return a!==e});var m=c.find(this.config.selectors.storeNotificationButtonNext),n=c.find(this.config.selectors.storeNotificationButtonSubmit);0===Object.keys(this.config.storeNotificationStores).length?(m[0].disabled=!0,n[0].disabled=!0,b(".md-fsf__store-icon-notification-item--pilot-notify-a").css("display","flex"),b(".md-fsf__store-icon-notification-item--pilot-notify-b").css("display","none")):Object.keys(this.config.storeNotificationStores).length<3&&b(c.find(this.config.selectors.storeNotificationAddStore)).show()},this),0),a.preventDefault()},n.prototype._getUrlParametersAsObject=function(a){return JSON.parse('{"'+decodeURI(a).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')},n.prototype._initStorePopUp=function(a){for(var b=0;b -1?a.config.selectedFilters.splice(c,1):a.config.selectedFilters.push(b(this).val()),a._getStores()})},i.prototype._queryMap=function(a){this.geocoder.geocode({address:a},_.bind(this._geocoderCallback,this))},i.prototype._geocoderCallback=function(c,d){d===a.google.maps.GeocoderStatus.OK?(this.config.$el.find(this.config.selectors.searchError).hide(),this.config.$el.find(this.config.selectors.storeListSearchError).hide(),this.query_location=c[0].geometry.location,this.map.setCenter(this.query_location),this._getStores()):(this.config.$el.find(this.config.selectors.searchError).show(),this.config.$el.find(this.config.selectors.storeListSearchError).show(),b(".md-fsf__filters-container").removeClass("md-fsf__filters-container--disabled"),b(".wg-fsfb__search-form").removeClass("wg-fsfb__search-form--disabled"))},i.prototype._getStores=function(){google.maps.event.removeListener(this.zoomChangedListener),google.maps.event.removeListener(this.dragEndListener),b(".md-fsf__filters-container").addClass("md-fsf__filters-container--disabled"),b(".wg-fsfb__search-form").addClass("wg-fsfb__search-form--disabled"),this._clearAllMarkers(),this.config.$el.find(this.config.selectors.finderLoading).addClass(this.config.classes.loadingVisible);var a;a=h.IsAntigenTestFinder?{lang:g.getShortLanguageCode(),testAvailable:this.config.selectedFilters.join(","),lat:this.query_location.lat(),lng:this.query_location.lng(),minLat:this.map.getBounds().getSouthWest().lat(),minLng:this.map.getBounds().getSouthWest().lng(),maxLat:this.map.getBounds().getNorthEast().lat(),maxLng:this.map.getBounds().getNorthEast().lng()}:{lang:g.getShortLanguageCode(),covidBrands:this.config.selectedFilters.join(","),lat:this.query_location.lat(),lng:this.query_location.lng(),minLat:this.map.getBounds().getSouthWest().lat(),minLng:this.map.getBounds().getSouthWest().lng(),maxLat:this.map.getBounds().getNorthEast().lat(),maxLng:this.map.getBounds().getNorthEast().lng()},b.ajax({method:"GET",url:"/sdmapi/store/GetCovidShotStores",data:a}).done(_.bind(function(a){if(a){this.config.storeHoursPopUps={},this.config.$el.find(this.config.selectors.finderLoading).removeClass(this.config.classes.loadingVisible),this._renderStoreList(a),this._addMarkerToMap(a);var c=this;this.dragEndListener=google.maps.event.addListenerOnce(this.map,"dragend",function(){c.dragEndListener=google.maps.event.addListenerOnce(c.map,"idle",function(){c._getStores()})}),this.zoomChangedListener=google.maps.event.addListenerOnce(this.map,"zoom_changed",function(){c._getStores()}),b(".md-fsf__filters-container").removeClass("md-fsf__filters-container--disabled"),b(".wg-fsfb__search-form").removeClass("wg-fsfb__search-form--disabled")}},this)).fail(function(a){console.log(a)})},i.prototype._addMarkerToMap=function(a){if(0!==a.length){this.bounds=new google.maps.LatLngBounds;for(var c=_.template(b(this.config.templates.storeInfo).html()),d=0;d 0?e.storeUrl="https://stores.shoppersdrugmart.ca/"+g.getShortLanguageCode()+"/store/"+e.StoreID:e.storeUrl="https://stores.pharmaprix.ca/"+g.getShortLanguageCode()+"/store/"+e.StoreID;var f=d+1,i="",j={};h.IsAntigenTestFinder?e.AntigenTestAvailable?(i="/static/core/images/covid-shot-available-pin.png",j={text:String(f),fontSize:"16px",fontWeight:"bold",color:"white"}):(i="/static/core/images/covid-shot-unavailable-pin.png",j={text:String(f),fontSize:"16px",fontWeight:"bold",color:"black"}):e.VaccineAvailable?(i="/static/core/images/covid-shot-available-pin.png",j={text:String(f),fontSize:"16px",fontWeight:"bold",color:"white"}):(i="/static/core/images/covid-shot-unavailable-pin.png",j={text:String(f),fontSize:"16px",fontWeight:"bold",color:"black"});var k=new google.maps.Marker({position:{lat:e.Latitude,lng:e.Longitude},map:this.map,label:j,icon:{url:i,scaledSize:new google.maps.Size(24.5,35.5),labelOrigin:new google.maps.Point(12,15)}});this.markers.push(k);var l=new google.maps.InfoWindow({content:c({store:e})});k.addListener("click",_.bind(this._openInfoWindow,this,l,this.map,k))}}},i.prototype._openInfoWindow=function(a,b,c){this.lastInfoWindow&&this.lastInfoWindow.close(),a.open(b,c),this.lastInfoWindow=a,google.maps.event.addListener(a,"domready",_.bind(this._initInfoWindow,this))},i.prototype._initInfoWindow=function(){var a=b(this.config.$el.find(this.config.selectors.storeInfoStoreHours)),c=b(a.closest(this.config.selectors.storeInfoStore));this.config.tempStoreId=c.data(this.config.data.storeInfoStoreId)},i.prototype._clearAllMarkers=function(){for(var a=0;a 0){this.config.$el.find(this.config.selectors.searchError).hide(),this.config.$el.find(this.config.selectors.storeListSearchError).hide();for(var c=0;a.length>c;c++)window.location.host.search("shoppersdrugmart")>0?a[c].storeUrl="https://stores.shoppersdrugmart.ca/"+g.getShortLanguageCode()+"/store/"+a[c].StoreID:a[c].storeUrl="https://stores.pharmaprix.ca/"+g.getShortLanguageCode()+"/store/"+a[c].StoreID;this.config.$el.find(this.config.selectors.storeList).removeClass(this.config.classes.storeListCollapse);var d=_.template(b(this.config.templates.storeList).html());this.config.$el.find(this.config.selectors.storeList).html(d({storeList:a,medmeBypassProvinces:h.MedmeBypassProvinces}))}else this.config.$el.find(this.config.selectors.storeList).addClass(this.config.classes.storeListCollapse),this.config.$el.find(this.config.selectors.searchError).show(),this.config.$el.find(this.config.selectors.storeListSearchError).show()},i.prototype._getUrlParametersAsObject=function(a){return JSON.parse('{"'+decodeURIComponent(a).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}')},i.prototype._initStorePopUp=function(a){for(var c=0;c b.name?1:0}),a},categoryFilters:function(){var a=f.map(function(a){return{id:a.id,name:a.Name}});return a.sort(function(a,b){return a.name b.name?1:0}),a},filteredProducts:function(){var a=this.allProducts.map(function(a){var b={inventory:{ShopLabel:j.ShopLabel,checkStockCountLabel:j.CheckOtherStoresLabel,CheckAvailabilityLabel:j.CheckAvailabilityLabel,stockCountLabel:j.InStoreLabel,ourStockLabel:j.OurStockLabel}};return Object.assign({},a,b)});return this.brandFiltersSelected.length>0&&(a=a.filter(function(a){return!!a.Content.Brand&&this.brandFiltersSelected.includes(a.Content.Brand.ID)}.bind(this))),this.categoryFiltersSelected.length>0&&(a=a.filter(function(a){var b=a.Taxonomies.reduce(function(a,b){return a.push(b.Category.id),a},[]);return!!this.categoryFiltersSelected.find(function(a){return b.includes(a)})}.bind(this))),a},products:function(){return this.$el.querySelector(".module-gift-card-mall__products")&&TweenLite.to(this.$el.querySelector(".module-gift-card-mall__products"),.3,{opacity:1}),this.filteredProducts.sort(function(a,b){return a.Content.Title b.Content.Title?1:0}).slice(0,this.productsPerPage*this.currentPage)},isLoadMoreVisible:function(){return this.products.length 1){for(var b=0;b 0){c.DescriptionCTAHref=c.DescriptionCTA.match(/href="([^"]*)/)[1],c.DescriptionCTATarget=c.DescriptionCTA.match(/target="([^"]*)/)[1];var d=document.createElement("span");d.innerHTML=c.DescriptionCTA,c.DescriptionCTALabel=d.textContent||d.innerText}if(c.DescriptionCTA2&&c.DescriptionCTA2.length>0){c.DescriptionCTAHref2=c.DescriptionCTA2.match(/href="([^"]*)/)[1],c.DescriptionCTATarget2=c.DescriptionCTA2.match(/target="([^"]*)/)[1];var e=document.createElement("span");e.innerHTML=c.DescriptionCTA2,c.DescriptionCTALabel2=e.textContent||e.innerText}"False"===f.HideProvinceSelector?f.Slides[b].Provinces.includes(a)&&this.slides.push(c):this.slides.push(c)}},filterBottomCtaBadges:function(a){this.bottomCtaBadges=[];for(var b=0;b 0;){var d=[],e=c.splice(0,this.drugPerPage);e.length>0&&d.push(e),e=c.splice(0,this.drugPerPage),e.length>0&&d.push(e),this.paginatedDrugs.push(d)}this.paginatedDrugs&&this.paginatedDrugs.length>0&&this.drugListing.push(this.paginatedDrugs[0])}},this))},setActiveDrug:function(a){this.activeDrug=a},setActivePage:function(a){this.drugListing=[],this.activePage=a,this.paginatedDrugs&&this.paginatedDrugs[this.activePage]&&this.drugListing.push(this.paginatedDrugs[this.activePage]),d.scrollTo$ElementAsync($(this.$refs.drugListing))},loadMore:function(){this.activePage+1 0&&this.drugListing.push(this.paginatedDrugs[0])},toggleFilter:function(a){a.preventDefault(),this.activeFilter="Common"===this.activeFilter?"Brand":"Common"}},mounted:function(){this.getDrugsByFirstLetter(),this.$root.$on("pop-up-closed",function(){this.activeDrug=null},this),window.addEventListener("resize",this.handleResize)},computed:{alphabets:function(){for(var a=[],b=0;b<26;b++)a.push(String.fromCharCode(b+65));return a}},watch:{activeFilter:function(){this.paginatedDrugs=[],this.activePage=0,this.drugListing=[],this.getDrugsByFirstLetter(),this.$nextTick(_.bind(function(){var a=this.$refs["filter"+this.activeFilter];a&&a.focus()},this))}}})}}(this),function(a){var b=a.NR||(a.NR={}),c=b.resolve("SDM.Core.Modules"),d=b.resolve("SDM.DrugFinder.VueComponents");c.DrugFinderSearch=function(){new Vue({components:{"drug-finder-popup":d.PopUp},computed:{drugsSorted:function(){return this.drugs.sort(function(a,b){var c=a.IsBrand?a.BrandName:a.CommonName,d=b.IsBrand?b.BrandName:b.CommonName,e=new RegExp(this.searchTerm,"ig"),f=new RegExp(this.searchTerm,"ig"),g=e.exec(c),h=f.exec(d),i=g?g.join().length:0,j=h?h.join().length:0;return j>i?1:jd.toLowerCase()?1:0}.bind(this))}},data:function(){return{activeDrug:null,drugs:[],isDropdownVisible:!1,isDropdownLoading:!1,getDrugsBySearchTimeout:null,popupReferenceName:"drugFinderSearchPopup",searchTerm:"",isNoResultsFound:!1}},el:"#module-drug-finder-search",methods:{getDrugsBySearch:function(){if(!this.searchTerm||""===this.searchTerm||this.searchTerm.length<3)return void(this.drugs=[]);this.isDropdownLoading=!0,$.ajax({context:this,data:{search:this.searchTerm},method:"GET",url:"/en/DrugFinder/GetDrugsBySearch"}).done(function(a,b){"success"===b&&(this.drugs=JSON.parse(a),this.drugs.length>0?(this.isNoResultsFound=!1,this.isDropdownVisible=!0):this.isNoResultsFound=!0)}).always(function(){this.isDropdownLoading=!1})},getHighlightedDrugName:function(a){var b=a.IsBrand?a.BrandName:a.CommonName,c=new RegExp(this.searchTerm,"ig");return b.replace(c,function(a){return''+a+""})},reloadGetDrugsBySearch:function(){this.isNoResultsFound=!1,this.isDropdownVisible=!1,this.getDrugsBySearchTimeout&&clearTimeout(this.getDrugsBySearchTimeout),this.getDrugsBySearchTimeout=setTimeout(function(){this.getDrugsBySearch()}.bind(this),500)},search:function(){if(!this.searchTerm||""===this.searchTerm||this.searchTerm.length<3)return void(this.drugs=[]);this.reloadGetDrugsBySearch()},submit:function(){this.search(),0!==this.drugs.length&&this.setActiveDrug(this.drugs[0])},setActiveDrug:function(a){this.activeDrug=a},hideDropdown:function(){this.activeDrug||(this.isDropdownVisible=!1)},showDropdown:function(){this.drugs.length>0&&(this.isDropdownVisible=!0)}},mounted:function(){this.$root.$on("pop-up-closed",function(){this.activeDrug=null},this)}})}}(this),function(a){(a.NR||(a.NR={})).resolve("SDM.Core.Modules").DrugFinderDetails=function(){new Vue({el:"#module-drug-finder-details",data:function(){return{}},methods:{print:function(){a.print()}},mounted:function(){}})}}(this),function(a,b){var c=a.NR||(a.NR={}),d=c.resolve("SDM.Core.Modules"),e=this.SDM||(this.SDM={}),f=e.SubscriptionData||(e.SubscriptionData={}),g=c.resolve("SDM.Util"),h=c.resolve("SDM.Vue.Mixins");d.Subscription=function(){new Vue({el:"#module-subscription",data:function(){return{emailAddress:"",isPCOptimumSubscriptionLoading:!1,isSubscriptionLoading:!1,isPCOptimumSubscriptionConsented:"false",isPCOptimumSubscriptionCompleted:!1,isSubscriptionCompleted:!1,province:""}},methods:{formSubmit:function(){this.subscribe(),"true"===this.isPCOptimumSubscriptionConsented?this.pcoSubscribe():this.isPCOptimumSubscriptionCompleted=!0},pcoSubscribe:function(){this.isPCOptimumSubscriptionLoading=!0,b.ajax({context:this,cache:!1,contentType:"application/x-www-form-urlencoded",type:"POST",url:"/subscribe",data:{email:this.emailAddress,casl:""}}).done(function(a){"True"===a?(this.isPCOptimumSubscriptionLoading=!1,this.isPCOptimumSubscriptionCompleted=!0,g.scrollTo$ElementAsync(b("#module-subscription"))):console.log(err)}).fail(function(a){console.log(a)})},subscribe:function(){this.isSubscriptionLoading=!0,b.ajax({context:this,data:{email:this.emailAddress,subscriberKey:f.SubScriberKey,apiKey:f.ApiKey,siteCode:f.SiteCode,langCode:f.LangCode,sdmPromotion:this.isPCOptimumSubscriptionConsented,province:this.province},headers:{__RequestVerificationToken:f.Token},method:"POST",url:"/global/subscriptionsubmit"}).done(function(a,c){"success"===c?(this.isSubscriptionLoading=!1,this.isSubscriptionCompleted=!0,g.scrollTo$ElementAsync(b("#module-subscription"))):console.log(a)}).always(function(){this.isDropdownLoading=!1})}},mixins:[h.Geolocation],watch:{provinceCode:function(a){this.province=a}}})}}(this,this.jQuery),function(a){"use strict";var b=a.NR,c=b.resolve("SDM.Promotions");c.Initializer={init:function(){new Vue({el:"#app-all-optimum-offers",data:function(){return{filterSelected:"",promotionsModel:[],promotionsDisplayData:[],rootUrl:""}},mounted:function(){this.rootUrl=this.$el.attributes["data-root-url"].value,this.promotionsModel=JSON.parse(this.$el.attributes["data-promotions-model"].value),this.updatePromotionsDisplayData()},methods:{updatePromotionsDisplayData:function(){this.promotionsDisplayData=[];for(var a=[],b=0;b 0;return a=a||d.isArray(this._json.Promotions.Promotion)},a.prototype._findProperProductList=function(){var a=d(this._json.Promotions.Promotion).find(function(a){return"Zoned"===a._Type}),b=a?a.Product:this._json.Promotions.Promotion.Product;if(!d.isArray(b)){var c=[];return c.push(b),c}return b},a.prototype.getArray=function(){return this._products},a.prototype.getRawData=function(){return this._json},f.EflyerProductDataLoader={load:function(a,b){var c=e.Deferred();return e.get(this.getApiUrl(a,b)).done(d(function(a){c.resolve(this.parse(a))}).bind(this)).fail(function(a){c.reject(a)}),c.promise()},getApiUrl:function(a,b){return"/Handlers/EFlyerPromotions.ashx?category="+encodeURIComponent(a)+"&postalCode="+encodeURIComponent(b)},parse:function(b){return new a(b)}}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.SDM||(a.SDM={}),e="eflyer",f=a.NR||(a.NR={}),g=f.resolve("SDM.Core.Components.SliderCarousel"),h=d.EflyerProductDataLoader,i=null;i=d.Eflyer=function(a){this._setInstanceVars(a),this._initialize()},i.prototype._setInstanceVars=function(a){this.consts={selectors:{carousel:"[data-wg-efl-carousel]",category_button:"[data-wg-efl-category-button]",postal_code_input:"[data-wg-efl-postal-code-input]",ml_text_overflow:"[data-wg-efl-ml-text-overflow]",category_select:"[data-wg-efl-category-select]"},attributes:{initial_category:"data-wg-efl-initial-category",category_button:"data-wg-efl-category-button",postal_code_input:"data-wg-efl-postal-code-input",carousel_item_template:"data-wg-efl-carousel-item-template",pagination_button_template:"data-wg-efl-carousel-pagination-template",loading:"data-wg-efl-carousel-loading"},class_names:{active:"active"}},this.slider_carousel_options={selectors:{carousel_container:"[data-wg-efl-carousel-container]"},attributes:{pc_visible:"wg-efl-number-visible-pc",mob_visible:"wg-efl-number-visible-mob",pc_toggle_at_once:"wg-efl-toggle-at-once-pc",mob_toggle_at_once:"wg-efl-toggle-at-once-mob"}},this.$container=a,this.category="",this.initial_category=a.attr(this.consts.attributes.initial_category),this.postal_code=a.find(this.consts.selectors.postal_code_input).attr("placeholder"),this.carousel=new g(a.find(this.consts.selectors.carousel),this.slider_carousel_options),this.$category_select=a.find(this.consts.selectors.category_select),this.locked=!1,this.carousel_item_template=b.template(a.find("["+this.consts.attributes.carousel_item_template+"]").html()),this.pagination_button_template=b.template(a.find("["+this.consts.attributes.pagination_button_template+"]").html()),this.$loading=a.find("["+this.consts.attributes.loading+"]")},i.prototype._initialize=function(){this._changeCategory(this.initial_category),this._bindInputEvents(),this._bindSelectEvents()},i.prototype._updateCarousel=function(){d.Util.validatePostalCode(this.postal_code.toUpperCase())&&(this.carousel.hideMainContainer(),this.$loading.show(),this.locked=!0,h.load(this.category,this.postal_code.toUpperCase()).done(b(function(a){var b=a.getArray();this.carousel.renderPanels(this.carousel_item_template({products:b})),this.carousel.renderPaginationButtons(this.pagination_button_template({length:b.length})),this.carousel.setNumberOfPanels(b.length),this.carousel.showMainContainer(),this.$loading.hide(),this.$container.find(this.consts.selectors.ml_text_overflow).mlTextOverflow(),this.locked=!1}).bind(this)))},i.prototype._bindInputEvents=function(){this.$container.on("keypress."+e,this.consts.selectors.postal_code_input,b.bind(this._onKeyPressPostalCodeInput,this)),this.$container.on("change."+e,this.consts.selectors.postal_code_input,b.bind(this._onChangePostalCodeInput,this)),this.$container.on("click."+e,this.consts.selectors.category_button,b.bind(this._onClickCategoryButton,this))},i.prototype._bindSelectEvents=function(){this.$category_select.on("change."+e,b(function(a){this._changeCategory(c(a.currentTarget).val())}).bind(this))},i.prototype._unbindSelectEvents=function(){this.$category_select.off("change."+e)},i.prototype._onKeyPressPostalCodeInput=function(a){var b=c(a.currentTarget);13!==a.which||this._isLocked()||(this.postal_code=""!==b.val()?b.val():b.prop("placeholder"),this._updateCarousel())},i.prototype._onChangePostalCodeInput=function(a){var b=c(a.currentTarget);this._isLocked()||(this.postal_code=""!==b.val()?b.val():b.prop("placeholder"),this._updateCarousel())},i.prototype._onClickCategoryButton=function(a){var b=c(a.currentTarget),d=b.attr(this.consts.attributes.category_button);this._changeCategory(d)},i.prototype._changeCategory=function(a){this._isLocked()||(this.category=a,this.$container.find(this.consts.selectors.category_button).removeClass(this.consts.class_names.active).filter("["+this.consts.attributes.category_button+"='"+a+"']").addClass(this.consts.class_names.active),this._unbindSelectEvents(),this.$category_select.val(a),this._bindSelectEvents(),this._updateCarousel())},i.prototype._isLocked=function(){return this.locked},i.prototype.updateCarousel=function(){this.carousel.updateMode()}}.call(this),function(){function a(a,b){this._initialize(a,b)}var b=this,c=b._,d=b.jQuery,e=b.NR||(b.NR={}),f=e.resolve("SDM"),g=e.resolve("SDM.Core.Components"),h=g.TabGroup,i=f.Util;a.prototype._initialize=function(a,b){var e=d("."+a.searchResultsClass),g=d("."+a.categoryLandingClass);if(e.length>0||g.length>0){this.config=a,this.statusObj={query:"",page:1,numres:a.resultsPerPage,filters:"",srhtype:"all",subbusunit:"all",sort:a.defaultSort,catid:""},this.queryObj={},this.responseObj={},this.checkboxes=b,this.searchURL=d(".ajax-form",this.$element).attr("action"),this.newfilters=!0,this.filters=[],this.urlVars=f.Util.getUrlVars(),this.statusObj=d.extend(!0,this.statusObj,this.urlVars||{});var i=f.Util.getFullLanguageCode(),j=c.isUndefined(this.urlVars.fltCat)?this.urlVars.fltcat:this.urlVars.fltCat;if(this.langMatch=!c.isUndefined(this.urlVars.quelang)&&this.urlVars.quelang===i||!c.isUndefined(j),e.length>0){this.$element=e,this.mode="search",this.tabs=new h(e,{selectors:{button:"[data-srh-tab-button]",content:"[data-srh-tab-content]"},attributes:{button:"data-srh-tab-button",content:"data-srh-tab-content"},classnames:{buttonDefault:"active",contentDefault:"wg-tcl-active"}}),this.tabs.onSwitch(function(a,b,c,d){d.trigger("reloadSearch",[{reloadType:"changeTab",newTabNum:a}])}),this.tabKey={all:1,products:2,articles:3,conditions:4};var k=c.bind(this._setUpFilter,this);$filters=d(".flt-mod",this.$element),c.each($filters,k),this._setUpFilterScroll(),this.$element.on("submit",c.bind(function(a){var b=d(this.config.queryInputSelector,this.$element).val();a.preventDefault(),history.pushState({reloadType:"changeQuery",query:b},"search query",window.location.href.replace(/query=.*?((?=&)|$)/,"query="+encodeURIComponent(b))),this.statusObj.page=1,this._reloadResults()},this))}g.length>0&&(this.$element=g,this.mode="category",this.statusObj.facets="products",this.statusObj.srhtype="products",this.statusObj.catid=d(".cat-lan-id").val(),this.$currentItmLst=d(".itm-lst",this.$element));var l=c.bind(this._handleReloadEvent,this),m=c.bind(this._handlePopEvent,this);if(this.$element.on("reloadSearch",l),this._reloadResults(),history.pushState){var n=window.location.href.match(/query=(.*?((?=&)|$))/,"query="+this.statusObj.query);history.replaceState({reloadType:"changeQuery",query:null!==n&&n.length>=1?n[1]:""},"search query",window.location.href),window.onpopstate=m}}},a.prototype._loadBV=function(a){var b={};void 0!==window.$BV&&(!1===a&&(a=[]),a.length>0&&(c.each(a,function(a){"undefined"!==a.Upc&&a.url&&(b[a.Upc.toString()]={url:document.location.protocol+"//"+document.location.host+a.url.toString()})}),$BV.ui("rr","inline_ratings",{productIds:b,containerPrefix:"BVRRInlineRating"})))},f.SearchResults=function(b,c){var e={searchResultsClass:"srh-res-form",categoryLandingClass:"cat-lan-form",loadMoreClass:"itm-lst-more",filterClass:"flt-mod",queryInputSelector:'[name="query"]',resultsPerPage:18,defaultFacets:"articles,conditions,products",defaultSort:"relavance",loadingClass:"srh-loading"};return this.config=d.extend(!0,e,b||{}),new a(this.config,c)},a.prototype._handleReloadEvent=function(a,b){var e=c.bind(this._parseCurrentFilters,this);if(!c.isUndefined(b))switch("changePage"!==b.reloadType&&(this.statusObj.page=1),b.reloadType){case"changeQuery":this.statusObj.query=d(this.config.queryInputSelector,this.$element).val(),this.newfilters=!0,this.statusObj.filters="";break;case"changeTab":this.statusObj.srhtype=c.invert(this.tabKey)[b.newTabNum],this.statusObj.sort=this.config.defaultSort,this.newfilters=!0,this.statusObj.filters="";break;case"changeSort":this.statusObj.sort=b.newSortType;break;case"changeFilter":this.statusObj.filters=e();break;case"changePage":this.statusObj.page=b.newPage,this.statusObj.filters=e()}this._reloadResults(b.reloadType)},a.prototype._handlePopEvent=function(a){"changeQuery"===a.state.reloadType&&(d(this.config.queryInputSelector,this.$element).val(a.state.query),this._handleReloadEvent(a,a.state))},a.prototype._parseCurrentFilters=function(){var a="",b=d(".flt-mod",this.$currentItmLst);return c.each(b,function(b){var e=d(b),f=d(".flt-lst-checked",e),g=d(".flt-lst-chbx",e).first().data("srh-flt-type");0===f.length?a=a+g+"NOFILTERS,":c.each(f,function(b){var e=d(b),f=e.data("srh-flt-type");f=c.isUndefined(f)?"sections,":f,a=a+f+encodeURIComponent(e.data("srh-checkbox"))+","})}),a},a.prototype._reloadResults=function(a){"search"===this.mode&&(this.currentTabNum=this.tabKey[this.statusObj.srhtype],this.currentTabNum=c.isUndefined(this.currentTabNum)?1:this.currentTabNum,this.tabs.goToTab(this.currentTabNum,!0)),"changePage"!==a&&this._clearResults(),this._makeQuery()},a.prototype._clearResults=function(){d(".itm-lst-header, .itm-lst-cnt",this.$currentItmLst).html(""),!0===this.newfilters&&d(".itm-lst-menu",this.$currentItmLst).hide(),"search"===this.mode&&(this.$currentItmLst=d(".tab-cont-"+this.statusObj.srhtype+" .itm-lst")),!0===this.newfilters&&"search"===this.mode&&d(".itm-lst-menu",this.$currentItmLst).html(""),this.$element.addClass(this.config.loadingClass)},a.prototype._makeQuery=function(){c.isUndefined(this.currentRequest)||this.currentRequest.abort();var a="type";"all"!==this.statusObj.srhtype&&(a+=",sections");var b="";switch(this.statusObj.srhtype){case"all":break;case"products":b="type,Product,"+this.statusObj.filters;break;case"articles":b="type,Article,"+this.statusObj.filters;break;case"conditions":b="type,Condition,"+this.statusObj.filters}var e=d(this.config.queryInputSelector,this.$element).val();if(this.queryObj={query:e,page:this.statusObj.page,numRes:this.statusObj.numres,facets:a,filters:b,getFilters:this.newfilters},"category"===this.mode){"0"===this.statusObj.catid||c.isUndefined(this.statusObj.catid)||(this.queryObj.categoryId=this.statusObj.catid);var f=c.isUndefined(this.urlVars.fltCat)?this.urlVars.fltcat:this.urlVars.fltCat;if(!(c.isUndefined(this.urlVars.brand)&&c.isUndefined(f)||(this.queryObj.brand=this.urlVars.brand,!0!==this.newfilters||!0!==this.langMatch))){var g="";c.each(this.urlVars,function(a,b){"flt-"!==b.slice(0,4)&&b.slice(0,6).toUpperCase()!=="fltCat".toUpperCase()||(g=g+","+encodeURIComponent(a)+",")}),this.queryObj.filters=b+g}}else c.isUndefined(this.urlVars.permflt)||(this.queryObj.andFilters=this.urlVars.permflt);var h=c.bind(this._populateResults,this),i=c.bind(this._ajaxErrorHandler,this);this.currentRequest=d.ajax({type:"POST",url:this.searchURL,data:this.queryObj,success:h,error:i})},a.prototype._ajaxErrorHandler=function(a,b,e){if("abort"!==e){var f=d("#SrhTemplError").html();d(".itm-lst-header",this.$currentItmLst).html(c.template(f,{})),this.$element.removeClass(this.config.loadingClass),d(".itm-lst-more--loading").removeClass("itm-lst-more--loading")}},a.prototype._populateResults=function(a){this.responseObj=a;var b={srhtype:this.statusObj.srhtype,query:this.responseObj.SwiftypeResults.info.page.query,current_page:this.responseObj.SwiftypeResults.info.page.current_page,num_pages:this.responseObj.SwiftypeResults.info.page.num_pages,per_page:this.responseObj.SwiftypeResults.info.page.per_page,total_result_count:this.responseObj.SwiftypeResults.info.page.total_result_count,results:this.responseObj.SwiftypeResults.records.page,storeResultTitle:this.responseObj.StoreResult.Title,storeResultUrl:"store-locator/store/"+this.responseObj.StoreResult.Id,filter_modules:this.responseObj.FilterModules,event_label:this.mode};b.storeResultTitle&&b.total_result_count++,c.isUndefined(this.responseObj.Info)||(b.all_total_result_count=this.responseObj.Info.page.total_result_count,b.facets_type=this.responseObj.Info.page.facets.type),c.each(b.results,function(a){if(a.published_at){var b,c=new Date(a.published_at);if(isNaN(c.getTime()))return void(a.published_at_formatted=null);b="fr"===i.getShortLanguageCode()?c.format("%r %B %Y","fr"):c.format("%b %r, %Y","en"),a.published_at_formatted=b}}),c.isNull(this.responseObj.SwiftypeResults.info.page.facets)||(b.facets_sections=this.responseObj.SwiftypeResults.info.page.facets.sections),"search"===this.mode&&(d(".res-num",this.$element).html("0"),d(".tab-all .res-num",this.$element).html(b.all_total_result_count),c.each(b.facets_type,function(a,b){var c=b.toLowerCase(),e=null===a?"0":a;d(".tab-"+c+" .res-num").html(e)}));var e=d("#SrhTemplHeader").html();d(".itm-lst-header",this.$currentItmLst).html(c.template(e)({templData:b}));var f=d(".itm-lst-menu",this.$currentItmLst);if("articles"!==this.statusObj.srhtype&&"conditions"!==this.statusObj.srhtype||!0!==this.newfilters){if("products"===this.statusObj.srhtype&&!0===this.newfilters&&!c.isUndefined(b.filter_modules)){if("search"!==this.mode&&this.urlVars.brand&&d(".flt-tax").hide(),!c.isUndefined(b.filter_modules.Brands)&&!c.isNull(b.filter_modules.Brands)){var g=c(b.filter_modules.Brands.Results).sortBy("Name"),h=c.groupBy(g,function(a){return a.Name.charAt(0).toLowerCase()}),j=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],k={};c.each(j,function(a){c.isUndefined(h[a])?k[a]=[]:k[a]=h[a]}),b.groupedBrands=k,b.numBrands=b.filter_modules.Brands.Results.length;var l=d("#SrhTemplBrandFlt").html();d(".itm-lst-menu",this.$currentItmLst).append(c.template(l)({templData:b}))}var m=d("#SrhTemplChbx").html();if(!c.isUndefined(b.filter_modules.Tags)&&!c.isNull(b.filter_modules.Tags)){var n={fltName:"Tags",prefix:b.filter_modules.Tags.Info[0].Prefix,filterByName:b.filter_modules.Tags.Info[0].FilterName,results:b.filter_modules.Tags.Results};d(".itm-lst-menu",this.$currentItmLst).prepend(c.template(m)({specTempData:n}))}c.each(b.filter_modules,function(a,b){if("Brands"!==b&&"Tags"!==b&&!c.isNull(a)){var e={fltName:b,prefix:a.Info[0].Prefix,filterByName:a.Info[0].FilterName,results:a.Results};0!==e.results.length&&d(".itm-lst-menu",this.$currentItmLst).append(c.template(m)({specTempData:e}))}});var o=c.bind(this._setUpFilter,this);$filters=d(".flt-mod",this.$currentItmLst),c.each($filters,o)}}else d(".flt-res-num",f).html("0"),c.each(b.facets_sections,function(a,b){d("[data-srh-checkbox='"+b.toLowerCase()+"']",f).siblings(".flt-lst-name-wrp").find(".flt-res-num").html(a)});d(".itm-lst-menu",this.$currentItmLst).show();var p=c.isUndefined(this.urlVars.fltCat)?this.urlVars.fltcat:this.urlVars.fltCat;"category"!==this.mode||!0!==this.newfilters||c.isUndefined(this.urlVars.brand)&&c.isUndefined(p)||!0!==this.langMatch||c.each(this.urlVars,function(a){var b=decodeURIComponent(a).split(":"),c=b[0],e=b[1]||"",f=d("[data-srh-flt-type='"+c+":'][data-srh-checkbox='"+e.replace(/'/g,"\\'")+"']"),g=f.parents(".flt-mod");f.length>0&&(d(".flt-lst-checked",g).removeClass("flt-lst-checked").attr("aria-checked",!1),f.addClass("flt-lst-checked").attr("aria-checked",!0),d(".nano",g).nanoScroller({scrollTo:f.parents(".flt-lst-item")}))});var q=d("#SrhTemplContProducts").html(),r=d("#SrhTemplContText").html();if("products"===this.statusObj.srhtype){if(d(".itm-lst-prod-items",this.$currentItmLst)[0]){var s=d(c.template(q)({templData:b})).children();d(".itm-lst-prod-items",this.$currentItmLst).append(s)}else d(".itm-lst-cnt",this.$currentItmLst).append(c.template(q)({templData:b}));this._loadBV(b.results)}else d(".itm-lst-cnt",this.$currentItmLst).append(c.template(r)({templData:b}));var t=d("#SrhTemplLoadMoreFooter").html();d(".itm-lst-footer",this.$currentItmLst).html(c.template(t)({templData:b})),0===b.total_result_count&&d(".itm-lst-footer",this.$currentItmLst).html(""),this._reinitialiseJS(),this.newfilters=!1,this.$element.removeClass(this.config.loadingClass)},a.prototype._reinitialiseJS=function(){var a=c.bind(this._loadMoreHandler,this),b=c.bind(this._changeDisplayNumber,this);d("."+this.config.loadMoreClass,this.$element).on("click",a),d(".itm-lst-display-num",".itm-lst-header").on("click",b),setTimeout(c.bind(this._setUpFilterScroll,this),0)},a.prototype._changeDisplayNumber=function(a){a.preventDefault(),this.statusObj.numres=d(a.currentTarget).data("itm-lst-display-num"),this.statusObj.page=1,this._reloadResults()},a.prototype._loadMoreHandler=function(a){a.preventDefault(),this.statusObj.page+=1;var b=this.statusObj.page;this.$element.trigger("reloadSearch",[{reloadType:"changePage",newPage:b}]),d(a.currentTarget).addClass("itm-lst-more--loading")},a.prototype._sortHandler=function(a){this.$element.trigger("reloadSearch",[{reloadType:"changeSort",newSortType:d(a.currentTarget).val()}])},a.prototype._setUpFilter=function(a){var b=d(a),e=c.bind(this._filterCollapseToggle,this),f=c.bind(this._filterAlphabet,this),g=c.bind(this._filterClear,this),h=c.bind(this._filterSelect,this),i=c.bind(this._chbxToggle,this);if(d(".flt-title",b).off().on("click",e),d(".flt-lst-alph-groups button",b).off().on("click",f),d(".flt-clr",b).off().on("click",g),d(".flt-sel",b).off().on("click",h),d(".flt-lst-chbx",b).off().on("click",i),b.hasClass("chbx-mod")){var j=c.bind(this._filterTreeCollapseToggle,this);d(".flt-lst-name",b).off().on("click",j)}this.filters.push({$filterElement:b})},a.prototype._setUpFilterScroll=function(){c.each(this.filters,function(a){d(".flt-lst-scl-wrp",a.$filterElement).nanoScroller({preventPageScrolling:!0,alwaysVisible:!0})})},a.prototype._chbxToggle=function(a){a.preventDefault();var b=d(a.currentTarget),c="flt-lst-checked";b.hasClass(c)?(b.removeClass(c).attr("aria-checked",!1),b.closest(".flt-lst-item").find("."+c).removeClass(c)):(b.addClass(c).attr("aria-checked",!0),b.parents(".flt-lst-item").children(".flt-lst-itm-label").find(".flt-lst-chbx").addClass(c)),this.$element.trigger("reloadSearch",[{reloadType:"changeFilter"}])},a.prototype._filterCollapseToggle=function(a){a.preventDefault(),$title=d(a.currentTarget),$title.parent().toggleClass("flt-collapsed")},a.prototype._filterTreeCollapseToggle=function(a){a.preventDefault(),$groupTitle=d(a.currentTarget),$groupTitle.parents(".flt-lst-item").first().toggleClass("flt-lst-closed")},a.prototype._filterAlphabet=function(a){a.preventDefault();var b=d(a.currentTarget),c=b.parent(),e=b.parents(".flt-mod"),f="active";c.siblings("."+f).removeClass(f),c.addClass(f),scrollToLetter=d(a.currentTarget).data("scrollto"),$scrolltoElement=d(".flt-lst-alph-let-"+scrollToLetter,e),d(".nano",e).nanoScroller({scrollTo:$scrolltoElement})}, a.prototype._filterClear=function(a){a.preventDefault();var b=d(a.currentTarget).parents(".flt-mod");d(".flt-lst-chbx",b).removeClass("flt-lst-checked").attr("aria-checked",!1),this.$element.trigger("reloadSearch",[{reloadType:"changeFilter"}])},a.prototype._filterSelect=function(a){a.preventDefault();var b=d(a.currentTarget).parents(".flt-mod");d(".flt-lst-chbx",b).addClass("flt-lst-checked").attr("aria-checked",!0),this.$element.trigger("reloadSearch",[{reloadType:"changeFilter"}])}}.call(this),function(){var a=this,b=a._,c=a.jQuery,d=a.SDM||(a.SDM={}),e=d.Util,f=d.QAB=function(a){var b={qabClass:"qab-wrp",activeClass:"active",preActiveClass:"pre-active",barOpenClass:"qab-open",panelSelector:".qab-tls-cnt",namespace:"qab",fadeDelay:5e3,fadeLength:1e3,input_focus_types:"input[type=text], input[type=tel]",navigateOnClickSelector:"[data-qab-tls-itm-nav-on-click]"};this.config=c.extend(!0,b,a||{}),this.namespace="qab",c("."+this.config.qabClass).length>0&&this._initialize()};f.prototype._initialize=function(){this.$element=c("."+this.config.qabClass);var d=b.bind(this._toggleItem,this);c(".qab-tls-btn",this.$element).on("click",d);var e=b.bind(this._toggleMinimode,this);if(c(".qab-icon",this.$element).on("click",e),c("."+this.config.preActiveClass,this.$element).length>0){var f=b.bind(this._fadeOutItem,this),g=setTimeout(f,this.config.fadeDelay);this.$element.on("mouseenter",function(){clearTimeout(g)})}var h=b.bind(this._toggleVisibleSelect,this);c('.rdo-rpl[data-rdo-name="choice"]',this.$element).on("click",h);var i=c(a);i.on("becometowide",b.bind(this._onWindowBecomeWide,this)),i.on("resizewhennarrow",b.bind(this._onWindowResizeWhenNarrow,this))},f.prototype._toggleItem=function(a){var d=c(a.currentTarget).parent();if(!d.is(this.config.navigateOnClickSelector)){if(a.preventDefault(),d.hasClass(this.config.activeClass))this._hideItems();else{this._showItem(d),c("."+this.config.activeClass,this.$element).not(d).removeClass(this.config.activeClass);var e=b.bind(function(a){0===c(a.target).parents(this.$element.selector).length&&this._hideItems()},this);c("body").on("click."+this.namespace,e)}this._updateBarAndPanelHeightsIfMobile()}},f.prototype._showItem=function(a){a.addClass(this.config.activeClass),a.find(this.config.input_focus_types).first().focus()},f.prototype._hideItems=function(){c("."+this.config.activeClass,this.$element).removeClass(this.config.activeClass),c("body").off("click."+this.namespace)},f.prototype._toggleMinimode=function(a){a.preventDefault(),c(a.currentTarget).parents(".qab-wrp").toggleClass(this.config.barOpenClass),this._updateBarAndPanelHeightsIfMobile()},f.prototype._fadeOutItem=function(){var a=b.bind(this._hideItems,this);c("."+this.config.preActiveClass+" .qab-tls-cnt",this.$element).fadeOut(this.config.fadeLength,function(){a(),c(this).attr("style","")}),this._updateBarAndPanelHeightsIfMobile()},f.prototype._toggleVisibleSelect=function(a){a.preventDefault();var b=c(a.currentTarget),d=b.data("rdo-name"),e=b.data("rdo-value"),f="qab-slt-active",g="rdo-active";c("."+g+'[data-rdo-name="'+d+'"]').removeClass(g),b.addClass(g);var h=c(".qab-slt."+f),i=h.find('select [value=""]').text();h.removeClass(f),h.find("select").val(""),h.find("[data-selectbox-text-container]").text(i),c('.qab-slt[data-qab-srh-selectbox="'+e+'"]').addClass(f)},f.prototype._onWindowResizeWhenNarrow=function(){this._updateBarAndPanelHeightsIfMobile()},f.prototype._onWindowBecomeWide=function(){this.$element.css({bottom:"auto"}),this.$element.find(".qab-tls-cnt").removeAttr("style")},f.prototype._updateBarAndPanelHeightsIfMobile=function(){if(!1!==e.isWindowNarrow()){var b="."+this.config.activeClass,d=this.$element.find(b),f=d.length>0;if(this.$element.hasClass(this.config.barOpenClass)&&f){var g=c(a).width(),h=d.find(this.config.panelSelector);h.css({width:g});var i=h.outerHeight(),j=this.$element.outerHeight(),k=i-j;this._setBottomIfMobile(Math.max(0,k))}else this._setBottomIfMobile(0)}},f.prototype._setBottomIfMobile=function(a){!1!==e.isWindowNarrow()&&this.$element.css({bottom:Math.max(0,a)+"px"})}}.call(this),function(){var a=this,b=a.$SDM||a.jQuery,c=a.NR||(a.NR={}),d=c.resolve("SDM"),e=c.resolve("SDM.Core"),f=c.resolve("SDM.Core.Components"),g=c.resolve("SDM.Core.Modules"),h=c.resolve("SDM.Core.Utils"),i=c.resolve("SDM.Core.Widgets"),j=c.resolve("SDM.Core.Components.BrooklynAuth.Settings"),k=c.resolve("SDM.Subscription"),l=c.resolve("SDM.Vue.Modules"),m=f.EventHub,n=h.OmnitureUtil,o=h.SiteTypes,p=e.Initializer=function(a){var c={modules:{article_and_video_badge_grid:"article-and-video-badge-grid",article_details:"article-details",article_grid_with_vertical_side:"article-grid-with-vertical-side",beauty_blog_post_details:"beauty-blog-post-details",beauty_blog_posts:"beauty-blog-posts",beauty_brands_listing:"beauty-brands-listing",bmi_calculator:"bmi-calculator",brooklyn_offers:"brooklyn-offers",condition_search:"condition-search",filter_toggle:"filter-toggle",image_gallery:"image-gallery",faq_section:"faq-section",featured_deals:"featured-deals",accordion_content_list:"accordion-content-list",video_player_mvc:"video-player-mvc",promo_badge:"promo-badge",pharmacy_service_list:"pharmacy-service-list",pharmacy_service_detail:"pharmacy-service-detail",flyer:"flyer",global_slider:"global-slider",contact_us:"contact-us",overlays:"overlays",brand_details:"brand-details",minor_ailments_list:"minor-ailments-list",custom_product_list:"custom-product-list",store_service_listing:"store-service-listing",global_tile_grid:"global-tile-grid",article_content_grid:"article-content-grid",flu_shot_finder:"flu-shot-finder",covid_shot_finder:"covid-shot-finder",store_locator_per_service:"store-locator-per-service",gift_card_mall:"gift-card-mall",dietitian_quiz:"dietitian-quiz",console_preorder:"console-preorder",console_preorder_banner:"console-preorder-banner",drug_finder_search:"drug-finder-search",drug_finder_listing:"drug-finder-listing",drug_finder_details:"drug-finder-details",subscription:"subscription",find_in_store:"find-in-store",love_you_donation:"love-you-donation",womens_health:"womens-health",apple:"apple",shoebox:"shoebox",sticky_navigation:"sticky-navigation",p3_2021:"p3-2021",global_cta_list:"global-cta-list",featured_products_carousel:"featured-products-carousel",featured_products_carousel_with_badge:"featured-products-carousel-with-badge",stick_promotion_bar:"stick-promotion-bar",dietitian_navigation:"dietitian-navigation",dietitian_book_appointment:"dietitian-book-appointment",dietitian_biography:"dietitian-biography",dietitian_socialfeed:"dietitian-socialfeed",promo_sign_up:"promo-sign-up",spring_2021:"spring-2021",two_level_navigation_menu:"two-level-navigation-menu",product_listing_with_feature_filter:"product-listing-with-feature-filter",summer_2021:"summer-2021",rich_text_area_geo:"rich-text-area-geo",video_product_carousel:"video-product-carousel",province_selector:"province-selector",text_badge_grid:"text-badge-grid",faq:"faq",global_promotion_grid:"global-promotion-grid",universal_cta_item_grid:"universal-cta-item-grid",mental_health_quiz:"mental-health-quiz",cta_offset_nav:"cta-offset-nav"},widgets:{print:"print",dscv_accordion:"dscv-accordion",accordion:"accordion",brooklyn_login:"brooklyn-login",brooklyn_logout:"brooklyn-logout",brooklyn_user_controls:"brooklyn-user-controls",brooklyn_points_refresh:"brooklyn-points-refresh",tab_group:"tab-group",eflyer:"eflyer",hero_carousel:"hero-carousel",slider_carousel:"slider-carousel",redemption_event:"redemption-event",faq_modal:"faq-modal",faq:"faq",unsupported_browser_warning:"unsupported-browser-warning",newsletter_subscription:"newsletter-subscription",image_popup:"image-popup",email_signup_popup:"email-signup-popup",email_signup:"email-signup",pharmacy_service_qab:"pharmacy-service-quick-access-bar",condition_alphabet:"condition-alphabet",featured_video:"featured-video",product_rating:"product-rating",general_article_summary_listing:"general-article-summary-listing",pop_up:"pop-up",pop_up_manager:"pop-up-manager",anchors_in_page:"anchors-in-page",search_bar:"search-bar",social_share:"social-share",flu_shot_finder_banner:"flu-shot-finder-banner",covid_shot_finder_banner:"covid-shot-finder-banner"},analytics:{userId_cookie:"sdm-analytics",custom_dimension_keys:{customer_key:"dimension1",channel:"dimension8",channel_details:"dimension9"}},youtube_api_key:"AIzaSyAqyipvzq62aB7-5OZ35FiVAp4T2WszDTM"};d.Vue.Vuex=new Vuex.Store({}),this.config=b.extend(!0,c,a||{}),j=_.extend(j,{loginEndPoint:this.config.LOGIN_ENDPOINT,protegrityDomain:this.config.PROTEGRITY_DOMAIN}),this._initialize()};p.prototype._initialize=function(){var c=b(a);d.Util({user_ip:this.config.user_ip,lang_code:this.config.lang_code,region:this.config.region}),k({});var e=d.GeoLocation();this._initializeModules(e),this._initializeWidgets(e),this._initializeMultiLinesTextOverflow(),this._initializeProperCase(),this._initializePlaceholder(),this._initializeSearchResults(),this._initializeAnalytics(),this._initializeQAB(),this._initializeImageTitleTag(),new d.Footer,d.Util.activateResizeEvent(),c.on("becometowide",_.bind(n.setSiteType,null,o.DESKTOP)),c.on("becometonarrow",_.bind(n.setSiteType,null,o.MOBILE)),n.setPageLanguage(d.Util.getFullLanguageCode()).setCustomerWalletId("").setLoginStatus(!1).setOptimumClaimed(!1).setSiteType(d.Util.isMobileDevice()?o.MOBILE:o.DESKTOP)},p.prototype._initializeModules=function(a){var c=b("[data-module]"),e=this.config.modules;c.each(_.bind(function(c,f){var h=b(f),i=h.data("module").split(/\s+/);_(i).each(_(function(c){switch(c){case e.article_grid_with_vertical_side:g.ArticleGridWithVerticalSide(h);break;case e.beauty_blog_post_details:this._initializeBeautyBlogPostDetailsModule(h);break;case e.beauty_blog_posts:this._initializeBeautyBlogPostsModule(h);break;case e.beauty_brands_listing:new g.BeautyBrandsListing(h);break;case e.bmi_calculator:this._initializeBmiCalculatorModule(h);break;case e.condition_search:g.ConditionSearch(h);break;case e.filter_toggle:this._initializeFilterToggles(h);break;case e.article_details:g.ArticleDetails(h.get(0));break;case e.image_gallery:this._initializeZooms(h);break;case e.faq_section:if(!l.FaqSection)break;l.FaqSection(h);break;case e.featured_deals:this._initializeFeatuedDeals(h);break;case e.global_slider:g.GlobalSlider(h);break;case e.video_player_mvc:this._initializeVideoPlayerMVC(h);break;case e.accordion_content_list:this._initializeAccordionContentList(h);break;case e.promo_badge:this._initializePromoBadge(h);break;case e.pharmacy_service_list:b.when(a).then(_.bind(function(){this._initializePharmacyServiceList(h,d.GeoLocation.getUsersProvince())},this));break;case e.pharmacy_service_detail:b.when(a).then(_.bind(function(){this._initializePharmacyServiceDetail(h,d.GeoLocation.getUsersProvince())},this));break;case e.flyer:this._initializFlyer(h);break;case e.contact_us:this._initializeContactUs(h);break;case e.overlays:this._initializeOverlays(h);break;case e.brand_details:this._initializeBrandDetails();break;case e.minor_ailments_list:b.when(a).then(_.bind(function(){this._initializeMinorAilmentsList(h,d.GeoLocation.getUsersProvince())},this));break;case e.custom_product_list:this._initializeCustomProductList(h);break;case e.store_service_listing:new g.StoreServiceListing(h);break;case e.global_tile_grid:new g.GlobalTileGrid(h);break;case e.article_content_grid:new g.ArticleContentGrid(h);break;case e.flu_shot_finder:new g.FluShotFinder(h);break;case e.covid_shot_finder:new g.CovidShotFinder(h);break;case e.drug_finder_search:new g.DrugFinderSearch(h);break;case e.drug_finder_listing:new g.DrugFinderListing(h);break;case e.drug_finder_details:new g.DrugFinderDetails(h);break;case e.store_locator_per_service:new g.StoreLocatorPerService(h);break;case e.gift_card_mall:new g.GiftCardMall(h);break;case e.dietitian_quiz:new g.DietitianQuiz(h);break;case e.console_preorder:new l.ConsolePreorder(h);break;case e.console_preorder_banner:new l.ConsolePreorderBanner(h);break;case e.love_you_donation:new l.LoveYouDonation(h);break;case e.apple:new l.Apple(h);break;case e.subscription:new g.Subscription(h);break;case e.find_in_store:new l.FindInStore(h);break;case e.womens_health:new l.WomensHealth(h);break;case e.shoebox:new l.Shoebox(h);break;case e.sticky_navigation:new l.StickyNavigation(h);break;case e.p3_2021:new l.P32021(h);break;case e.promo_sign_up:new l.PromoSignUp(h);break;case e.global_cta_list:new l.GlobalCtaList(h);break;case e.featured_products_carousel:new l.FeaturedProductsCarousel(h);break;case e.featured_products_carousel_with_badge:new l.FeaturedProductsCarouselWithBadge(h);break;case e.stick_promotion_bar:new l.StickyPromotionBar(h);break;case e.spring_2021:new l.Spring2021(h);break;case e.dietitian_navigation:new l.DietitionNavigation(h);break;case e.dietitian_book_appointment:new l.DietitianBookAppointment(h);break;case e.dietitian_biography:new l.DietitionBiography(h);break;case e.dietitian_socialfeed:new l.DietitionSocialFeed(h);break;case e.two_level_navigation_menu:new l.TwoLevelNavigationMenu(h);break;case e.product_listing_with_feature_filter:new l.ProductListingWithFeatureFilter(h);break;case e.article_and_video_badge_grid:new l.ArticleAndVideoBadgeGrid(h);break;case e.summer_2021:new l.Summer2021(h);break;case e.rich_text_area_geo:new l.RichTextAreaGeo(h);break;case e.video_product_carousel:new l.VideoProductCarousel(h);break;case e.province_selector:new l.ProvinceSelector(h);break;case e.text_badge_grid:new l.TextBadgeGrid(h);break;case e.faq:new l.Faq(h);break;case e.global_promotion_grid:new l.GlobalPromotionGrid(h);break;case e.universal_cta_item_grid:new l.UniversalCTAItemGrid(h);break;case e.mental_health_quiz:new l.MentalHealthQuiz(h);break;case e.cta_offset_nav:new l.CTAOffsetNav(h)}}).bind(this))},this))},p.prototype._initializeWidgets=function(a){var c=b("[data-widget]"),e=this.config.widgets;c.each(_.bind(function(c,f){var g=b(f),h=g.data("widget").split(/\s+/),j=this.config;_(h).each(_(function(c){switch(c){case e.print:this._initializePrintIcons(g);break;case e.dscv_accordion:this._initializeDiscoveryAccordions(g);break;case e.accordion:this._initializeAccordions(g);break;case e.brooklyn_login:new i.BrooklynLogin(g,j);break;case e.brooklyn_logout:new i.BrooklynLogout(g);break;case e.brooklyn_points_refresh:new i.BrooklynPointsRefresh({el:f});break;case e.tab_group:this._initializeTabGroup(g);break;case e.eflyer:b.when(a).then(_.bind(this._initializeEflyer,this,g));break;case e.slider_carousel:this._initializeSliderCarousel(g);break;case e.hero_carousel:this._initializeHeroCarousels(g);break;case e.redemption_event:this._initializeRedemptionEvent(g);break;case e.pharmacy_service_qab:b.when(a).then(_.bind(function(){this._initializePharmacyServicesQAB(g,d.GeoLocation.getUsersProvince())},this));break;case e.condition_alphabet:this._initializeConditionAlphabet(g);break;case e.featured_video:this._initializeFeaturedVideo(g);break;case e.product_rating:this._initializeProductRating(g);break;case e.faq_modal:this._initializeFAQModal(g);break;case e.faq:this._initializeFAQ(g);break;case e.unsupported_browser_warning:this._initializeUnsupportedBrowserWarning(g);break;case e.general_article_summary_listing:this._initializeGeneralArticleSummaryListing(g);break;case e.anchors_in_page:this._initializeAnchorsInPage(g);break;case e.pop_up:new i.PopUp(g);break;case e.pop_up_manager:this._initializePopUpManager(g);break;case e.social_share:this._initializeSocialShare(g);break;case e.newsletter_subscription:new i.NewsletterSubscription(g);break;case e.image_popup:new i.ImagePopup(g);break;case e.email_signup_popup:new i.EmailSignupPopup(g);break;case e.email_signup:new i.EmailSignup(g);break;case e.flu_shot_finder_banner:new i.FluShotFinderBanner(g);break;case e.search_bar:i.SearchBar(g);break;case e.covid_shot_finder_banner:new i.CovidShotFinderBanner(g)}}).bind(this))},this))},p.prototype._initializeSliderCarousel=function(a){var b=new f.SliderCarousel(a);m.subscribe(m.EVENTS.TAB_SWITCHED,function(){b.updateMode()})},p.prototype._initializeEflyer=function(a){var b=new d.Eflyer(a);m.subscribe(m.EVENTS.TAB_SWITCHED,function(){b.updateCarousel()})},p.prototype._initializeBeautyBlogPostDetailsModule=function(a){new g.BeautyBlogPostDetails(a)},p.prototype._initializeBeautyBlogPostsModule=function(a){new g.BeautyBlogPosts(a)},p.prototype._initializeBmiCalculatorModule=function(a){new g.BmiCalculator(a)},p.prototype._initializeFilterToggles=function(a){var b=a.find("[data-filter-toggle-button]"),c=a.find("[data-filter-toggle-content]"),d=!0;b.addClass("active"),c.show(),b.on("click.toggle",function(){d?(b.removeClass("active"),c.hide(),d=!1):(b.addClass("active"),c.show(),d=!0)})},p.prototype._initializeAnalytics=function(){var a=d.Util.getValueFromCookie(this.config.analytics.userId_cookie),b=this.config.analytics.custom_dimension_keys,c={},e=d.Util.getUrlVars()||{},f=e.channel||null,g=e.channelDetails||e.channeldetails||null;c[b.customer_key]=a,c[b.channel]=f,c[b.channel_details]=g},p.prototype._initializeMultiLinesTextOverflow=function(){b("[data-ml-text-overflow]").mlTextOverflow(),m.subscribe(m.EVENTS.TAB_SWITCHED,function(a){a.$content.find("[data-ml-text-overflow]").mlTextOverflow()})},p.prototype._initializeProperCase=function(){b("[data-prp-case]").each(function(){var a=b(this).text();b(this).text(d.Util.properCase(a))})},p.prototype._initializePlaceholder=function(){new Placeholder},p.prototype._initializeSearchResults=function(){new d.SearchResults({},"")},p.prototype._initializeHeroCarousels=function(a){new f.HeroCarousel(a)},p.prototype._initializeFeatuedDeals=function(a){new g.FeaturedDeals(a)},p.prototype._initializeAccordions=function(a){var b=new Accordion(a);b.isActive()&&b.open(0)},p.prototype._initializeTabGroup=function(a){new f.TabGroup(a).onSwitch(function(a,b,c){m.fire(m.EVENTS.TAB_SWITCHED,{tabId:a,$button:b,$content:c})})},p.prototype._initializePharmacyServicesQAB=function(a,b){new f.PharmacyServicesQAB(a,b)},p.prototype._initializeDiscoveryAccordions=function(){var a=[];return function(c){var d=new Accordion(c,{selectors:{button:"[data-dscv-accordion-button]",content:"[data-dscv-accordion-content]"},classnames:{active:"dscv-accordion-active",progress_of_showing:"dscv-accordion-showing",progress_of_hiding:"dscv-accordion-hiding"}});Accordion.validate(d)&&a.push(d),1===a.length&&(b(window).on("widen.dscv_accordion",function(){_(a).each(function(a){a.disable(),a.open(0)})}),b(window).on("narrow.dscv_accordion",function(){_(a).each(function(a,b){a.enable(),0===b?a.open(0):a.close(0)})}))}}(),p.prototype._initializeConditionAlphabet=function(a){new i.ConditionAlphabet(a)},p.prototype._initializeZooms=function(){return new f.Zoom},p.prototype._initializeFeaturedVideo=function(a){new i.FeaturedVideo(a,{youtube_api_key:this.config.youtube_api_key})},p.prototype._initializeProductRating=function(a){new i.ProductRating(a)},p.prototype._initializeQAB=function(){new d.QAB},p.prototype._initializePrintIcons=function(a){a.on("click",function(a){a.preventDefault(),window.print()})},p.prototype._initializeRedemptionEvent=function(a){new i.RedemptionEvent(a)},p.prototype._initializeVideoPlayerMVC=function(a){new g.VideoPlayerMVC(a)},p.prototype._initializeImageTitleTag=function(){b("img").each(function(){var a=b(this).attr("alt");if(""===a||void 0===a)return!0;var c=b(this).attr("title");""!==c&&void 0!==c||b(this).attr("title",a)})},p.prototype._initializeFAQModal=function(a){new i.FAQModal(a)},p.prototype._initializeFAQ=function(a){new i.FAQ(a)},p.prototype._initializeUnsupportedBrowserWarning=function(a){new i.UnsupportedBrowserWarning(a)},p.prototype._initializeGeneralArticleSummaryListing=function(a){new i.GeneralArticleSummaryListing(a)},p.prototype._initializeAnchorsInPage=function(a){new i.AnchorsInPage(a)},p.prototype._initializeAccordionContentList=function(a){new g.AccordionContentList(a)},p.prototype._initializePharmacyServiceList=function(a,b){new g.PharmacyServiceList(a,b)},p.prototype._initializePharmacyServiceDetail=function(a,b){new g.PharmacyServiceDetail(a,b)},p.prototype._initializePromoBadge=function(a){new g.PromoBadge(a)},p.prototype._initializFlyer=function(a){new g.Flyer(a)},p.prototype._initializeContactUs=function(a){new g.ContactUs(a)},p.prototype._initializeOverlays=function(a){new g.Overlays(a)},p.prototype._initializeBrandDetails=function(){new g.BrandDetails},p.prototype._initializeMinorAilmentsList=function(a,b){new g.MinorAilmentsList(a,b)},p.prototype._initializePopUpManager=function(a){new i.PopUpManager(a)},p.prototype._initializeSocialShare=function(a){new i.SocialShare(a)},p.prototype._initializeCustomProductList=function(a){new g.CustomProductList.Controller(a)}}.call(this);